Home > Backend Development > PHP Tutorial > php 设置 url

php 设置 url

WBOY
Release: 2016-06-06 20:51:34
Original
1114 people have browsed it

这个大家可能很少见,自己写着玩儿的。

if ($page_num > 1) {
		echo '<span><a href="'.%24pageurl.'page='.(%24page_num+1).'">下一页</a>》</span>';
	}
Copy after login
Copy after login

if ($page_num > 1) {
                $page_num++;
		echo '<span><a href="'.%24pageurl.'page='.%24page_num.'">下一页</a></span>';
	}
Copy after login
Copy after login

直接用php和mysql做翻页,为什么第一个有用,而第二个向下翻页到第二页之后就没用呢?
即使在第二个里面使用

$page_num += 1;
Copy after login
Copy after login

也是没有效果的

回复内容:

这个大家可能很少见,自己写着玩儿的。

if ($page_num > 1) {
		echo '<span><a href="'.%24pageurl.'page='.(%24page_num+1).'">下一页</a>》</span>';
	}
Copy after login
Copy after login

if ($page_num > 1) {
                $page_num++;
		echo '<span><a href="'.%24pageurl.'page='.%24page_num.'">下一页</a></span>';
	}
Copy after login
Copy after login

直接用php和mysql做翻页,为什么第一个有用,而第二个向下翻页到第二页之后就没用呢?
即使在第二个里面使用

$page_num += 1;
Copy after login
Copy after login

也是没有效果的

请发完整的代码过来。我觉得你的这个实现不优雅呀……

$page_num++ 已经 in-place 的修改了 page_num, $page_num + 1 没有。给你汇编代码可能能容易理解?

addl $1, page_num
Copy after login

这是 page_num ++

movl page_num, %eax
addl $1, %eax
Copy after login

这是 page_num += 1, page_num 内存值没变,而是被拷贝到了 eax 寄存器中,然后在 eax 寄存器中 +1 输出。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template