Home > Backend Development > PHP Tutorial > PHP的If语法问题!

PHP的If语法问题!

WBOY
Release: 2016-06-23 14:24:17
Original
986 people have browsed it

if (stripos($url,"page=")=false) {	$url=$url."?page=1";}
Copy after login


这样的代码,调试的时候提示Parse error: syntax error, unexpected 'if' (T_IF) in D:\wamp\www\page\page.class.php on line 11

不知道怎么回事,谢谢。


回复讨论(解决方案)

if (stripos($url,"page=") ==false) {
    $url=$url."?page=1";
}

这赋值和判断得分清啊!


if (stripos($url,"page=")==false) {
    $url=$url."?page=1";
}


每个人都会犯的错误

上面的人写法都有问题
if (stripos($url,"page=")===false) {
    $url=$url."?page=1";
}
三个等号,这样才正确!
分给我吧,急需要分,谢谢

上面的人写法都有问题
if (stripos($url,"page=")===false) {
    $url=$url."?page=1";
}
三个等号,这样才正确!
分给我吧,急需要分,谢谢

谢谢

我补充一句,如果在位置0的话 会返回0,0==false

Related labels:
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