if equals 上的奇怪 php 输出
我已在服务器上上传了一个版本,但出现了本地环境中没有的错误。 我有这个对象
stdClass Object (
[type] => education
[tutor_title] => Computer skills for the workplace
[tutor_title_description] => portland college
)
,当我执行此块时:
if ('education' == $qualification->type)
{
echo 'yes';die();
}
else
{
echo 'no';die();
}
我总是得到“否”。我不知道为什么。我尝试这样做:
if ('education' === $qualification->type)
if ($qualification->type == 'education')
- < code>if ($qualification->type === 'education')
和相同的输出。这很奇怪,为什么会出现这种情况呢?
I have uploaded a version on a server and I get an error which I did not have on local environment.
I have this object
stdClass Object (
[type] => education
[tutor_title] => Computer skills for the workplace
[tutor_title_description] => portland college
)
and when I do this block:
if ('education' == $qualification->type)
{
echo 'yes';die();
}
else
{
echo 'no';die();
}
I always get no. I don't know why. I have tried to do:
if ('education' === $qualification->type)
if ($qualification->type == 'education')
if ($qualification->type === 'education')
and same output. This is strange why is this happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果执行
var_dump($qualification);
,您会得到什么? “教育”之后是否还有一个空格?What do you get if you do
var_dump($qualification);
? Is there perhaps a space after "education" or so?尝试使用
In以防类型周围有任何空格字符。
Try using
In case there are any space characters around type.