5.0.0 - 普通 - 未处理
版本是ThinkPHP5.1*下面是一个控制器的代码,有正常提示和没有代码提示的位置注释在代码中了
<?php
namespace app\admin\controller;
use app\admin\model\TestModel;
use think\Controller;
class IndexController extends Controller
{
public function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
$this->model = new TestModel();
$this->model->//这里有正常的代码提示
}
public function index(){
$this->model->//这里没有代码提示
return $this->fetch();
}
}将initialize换成__construct代码提示就正常了<?php
namespace app\admin\controller;
use app\admin\model\TestModel;
use think\App;
use think\Controller;
class IndexController extends Controller
{
public function __construct(App $app = null)
{
parent::__construct($app);
$this->model = new TestModel();
}
public function index(){
$this->model->//使用__construct后,这里代码提示正常了
return $this->fetch();
}
}5.0的用initialize可以有正常的代码提示,这个应该是tp5.1使用了容器导致的 