[英]HHVM, autoload and namespace
The error: 错误:
\\nFatal error: Class undefined: DI in /home/runeko/www/index.php on line 7 \\ n致命错误:类未定义:第7行/home/runeko/www/index.php中的DI
My folder structure: 我的文件夹结构:
- core
- DI.php
- index.php
index.php: index.php:
<?php
set_include_path( __DIR__ );
spl_autoload_extensions('.php');
spl_autoload_register();
use \core;
$di = new DI();
//i tested too: $di = \core\DI();
DI.php DI.php
<?php
namespace \core;
class DI {
}
HHVM version: HHVM版本:
root@akai:/var/log/hhvm# hhvm --version
HipHop VM 3.0.0-dev+2014.04.03 (rel)
Compiler: heads/master-0-g6398683df312015ebc40066dfe4b9242cc933a60
Repo schema: b4303360e484eee1f582365b9994eee150d450b0
is hhvm bugged? hhvm是否被窃听? thanks.
谢谢。
The solution: * This feature isn't implemented yet * -> https://github.com/facebook/hhvm/issues/2308 解决方案: * 此功能尚未实现 *-> https://github.com/facebook/hhvm/issues/2308
http://docs.hhvm.com/manual/en/language.types.object.php http://docs.hhvm.com/manual/en/language.types.object.php
According to the official documentation, the object instantiation is not changed as in PHP, you need to use new
keyword 根据官方文档,对象实例化不会像PHP中那样更改,您需要使用
new
关键字
use \core;
$di = new DI();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.