用method_exists一直提示方法不存在,请问具体怎么调试这个错误?

WBOY
Release: 2016-06-23 13:49:38
Original
2735 people have browsed it

$jms=new $control($conf['db']['dsn'], $conf['db']['user'], $conf['db']['password']);
$jms->debugLevel=$conf['debug']['level'];
if(!method_exists($jms, $action)) notfound('方法不存在');


回复讨论(解决方案)

还有人在吗?

print_r(get_class_methods($jms));
看看$action 的值是否在其中

php 说不存在,那就是不存在了

你看下你调用的方法是不是没有引入到项目中导致了明明有这个方法却不能调用的情况。

谢谢楼上两位!

问题昨天晚上自己已经解决。是因为项目用的PDO这个组件,自己是新手,后在php.ini文件里面打开PDO组件支持就可以了。

 $jms=new $control($conf['db']['dsn'], $conf['db']['user'], $conf['db']['password']);
是不是你实例化类方法,里面报的错吧,后面没有执行下去。

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