为何function_exists 总返回faulse

WBOY
Release: 2016-06-13 10:35:15
Original
1236 people have browsed it

为什么function_exists 总返回faulse?
如题。函数写在另一个php文件中,调用function_exists之前,用include包含进来。
可是就是返回false,想不明白。

  谢谢各位

------解决方案--------------------
php文件名一致吗?
函数名称一致吗?
大小写一样吗?
------解决方案--------------------
你把那个函数放到你判断的这个页面上来
如下:
function aa(){
return 'bb';
}
if (function_exists(aa))
{
echo 'yes';
}else{
echo 'no';
}
这种情况我测是输出yes的,没问题的,
另外,也可以直接在你这个页面去调用那个函数,看会不会出错,如果不出错,但用function_exists判断时却不对的话,可能是你的PHP版本或是环境的问题吧,一般不会出问题的。。
------解决方案--------------------
请帖出示例文件

应该是嵌入文件中出错了
------解决方案--------------------
看看一楼说的,要么就是你包含时出了问题,我用include,require测试都没问题。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!