Php STRPO始终返回相同的值

Php STRPO始终返回相同的值,php,Php,在这两种情况下,它都返回b if(strpos('1', "Content-Length: 1 12327225") !== false) { echo 'a'; } else { echo 'b'; } if(strpos('foqerwerun', "Content-Length: 1 12327225") !== false) { echo 'a'; } else { echo 'b'; } 有什么问题吗?您使用不正确。语法是strpos(字符串$hay

在这两种情况下,它都返回
b

if(strpos('1', "Content-Length: 1 12327225") !== false) {
    echo 'a';
} else {
    echo 'b';
}

if(strpos('foqerwerun', "Content-Length: 1 12327225") !== false) {
    echo 'a';
} else {
    echo 'b';
}
有什么问题吗?

您使用不正确。语法是
strpos(字符串$haystack,mixed$needle[,int$offset=0])。
搜索的字符串在第二个参数中,搜索的字符串在第一个参数中

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}
你用错了。语法是
strpos(字符串$haystack,mixed$needle[,int$offset=0])。
搜索的字符串在第二个参数中,搜索的字符串在第一个参数中

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}
你用错了。语法是
strpos(字符串$haystack,mixed$needle[,int$offset=0])。
搜索的字符串在第二个参数中,搜索的字符串在第一个参数中

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}
你用错了。语法是
strpos(字符串$haystack,mixed$needle[,int$offset=0])。
搜索的字符串在第二个参数中,搜索的字符串在第一个参数中

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}

if(strpos("Content-Length: 1 12327225", '1') !== false) {
    echo 'a';
} else {
    echo 'b';
}