控制器 代码:
<?php
namespace app\index\controller;
use app\index\model\PublicUsers;
class Index
{
public function index()
{
$list = PublicUsers::select();
foreach ($list as $value) {
echo $value['factory']['factoryname']."<br>";
}
}
}
模型代码
namespace app\index\model;
use think\Model;
class PublicUsers extends Model
{
public function factory()
{
return $this->hasOne('PublicFactorys','id','factoryid');
}
public function partment()
{
// 用户HAS ONE档案关联
return $this->hasOne('PublicPartments','id','partmentid');
}
public function author()
{
// 用户HAS ONE档案关联
return $this->hasOne('PublicAuthors','id','authorid');
}
}
打开调试运行就报错,错误信息:( ! ) InvalidArgumentException: property not exists:app\index\model\PublicUsers->factory in D:\phpweb\thinkphptest\thinkphp\library\think\Model.php on line 378
,关闭调试功能就能正常输出,请教一下是什么原因 ,该怎么处理
		 3333.png
		( 75.52 KB 下载:4 次 )
		3333.png
		( 75.52 KB 下载:4 次 )
	
最佳答案
		