PHP问题 —— The use statement with non-compound name

2023-06-08,,

1.1  The use statement with non-compound name

1.1.1  现象

调试程序,发现运行如下代码程序就跑飞了:

require_once __DIR__ . '/actions/' . $refectClass . '.php';

1.1.2  原因

因为是在PHPStorm中调试,一开始查看__DIR__变量,发现其一直为xdebug,遂以为是这个问题,网上查找很多资料均没有解决方案。

后来查看错误日志,发现有如下错误信息:

2014-05-12 16:41:53: <E> [php                 ]: The use statement with non-compound name 'CommonUtils' has no effect (D:\ProjectWork\SourceCode\Server\i2goods\protected\components\clientapi\actions\BookEditAction.php:9)

 

打开BookEditAction.php文件,查看第9行代码,发现是:

use CommonUtils

网上查找资料,发现这样的use用法语法错误。

1.1.3  解决

咨询相关开发人员,此代码为垃圾代码,忘记删除,将其删除后就好了。

《PHP问题 —— The use statement with non-compound name.doc》

下载本文的Word格式文档,以方便收藏与打印。