質問

The error:

\nFatal error: Class undefined: DI in /home/runeko/www/index.php on line 7


My folder structure:

- core
  - DI.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

<?php

namespace \core;

class DI {
}

HHVM version:

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? thanks.

The solution: *This feature isn't implemented yet* -> https://github.com/facebook/hhvm/issues/2308

役に立ちましたか?

解決

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

use \core;
$di = new DI();
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top