douyan4900
2014-04-12 19:50
浏览 57
已采纳

PHP使用变量声明类

Im trying to execute the following code

$our_controller = new App\Controllers\$routing->_new['controller']();

But Im getting 'Unexpected $routing'

And this is the class Im trying to load looks like

namespace App\Controllers;

class HomeController extends BaseController
{
      public function __construct()
      {
          parent::__construct();
      }
}

If I type the following

$our_controller = new App\Controllers\HomeController();

Works perfectly but I must use the variable instead of HomeController

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题