当我看到此reference
中的代码时当我必须从构造函数中删除null
值时,出现一个错误,即在控制器中实例化模型类时未定义构造函数。
public function __construct($name = null,$city = null,$country = null)
{
$this->name = $name;
$this->city = $city;
$this->country = $country;
}
您能否在模型类构造函数中不使用null
参数的情况下提供解决方案?