简体   繁体   English

在PHP中无法组合strpos和!empty,为什么?

[英]Can't combine strpos and !empty in PHP, why?

I have two lines in PHP that if I combine causes my page to stop loading...Unfortunately, I have no error message using error_reporting(E_ALL | E_STRICT); ini_set('display_errors', true); 我在PHP中有两行,如果我合并导致我的页面停止加载...不幸的是,我没有使用error_reporting(E_ALL | E_STRICT); ini_set('display_errors', true);错误消息error_reporting(E_ALL | E_STRICT); ini_set('display_errors', true); error_reporting(E_ALL | E_STRICT); ini_set('display_errors', true); , and nothing in my apache error.log file. ,我的apache error.log文件中没有任何内容。

this works: 这工作:

$user_setup = strpos($_SESSION['user'], "@");
if (!empty($user_setup)) {....

But, this does not: 但是,这不是:

if (!empty(strpos($_SESSION['user'], "@"))) {....

Is there something about the strpos function causing this to not work? strpos功能有什么原因导致它不起作用吗?

Thanks for your help! 谢谢你的帮助!

empty() is actually a language construct not a function. empty()实际上是一个语言结构而不是一个函数。 Additionally it won't take anything less than a variable as an argument. 另外,它不会将变量作为参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM