Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Activerecord yii获取唯一数据时出现活动记录错误_Activerecord_Yii_Model - Fatal编程技术网

Activerecord yii获取唯一数据时出现活动记录错误

Activerecord yii获取唯一数据时出现活动记录错误,activerecord,yii,model,Activerecord,Yii,Model,如何更正此错误?我正在使用Yii,但在获取没有路径的唯一域时遇到了一个问题 Error: Property "Promotions.getmBaseUrl" is not defined. 表内数据: example.com/a/ggd.html example.com/b/hdgg.html assiggnmenthelp.net/page.html stackoverflow.com/quest

如何更正此错误?我正在使用Yii,但在获取没有路径的唯一域时遇到了一个问题

Error: Property "Promotions.getmBaseUrl" is not defined.
表内数据:

            example.com/a/ggd.html
            example.com/b/hdgg.html
            assiggnmenthelp.net/page.html
            stackoverflow.com/questions/ask?title=yii
我想在视图中显示唯一的域

输出应该是

            example.com
            assiggnmenthelp.net
            stackoverflow.com
但这段代码没有按预期工作

代码:


对不起,我忘记添加代码了。私有函数getmBaseUrl$url{LUrl::getBaseUrl$url;}公共函数getfiftyUrl{$crt=new-CDbCriteria;$crt->select=$this->getmBaseUrlt.website;$crt->order='id DESC';返回新的CActiveDataProvider$this,数组'criteria'=>$crt,'pagination'=>array'pageSize'=>10,;}编辑应该被批准。对这个问题的编辑收到了两个拒绝和两个批准。这两个方法写在同一个文件中吗?我认为错误是由于运行时访问了私有函数getmBaseUrl$url,尽管它应该有一个返回语句,返回CDbCriteria->selectTry:$crt->select=$此->getmBaseUrlt.website;尝试删除引号。
 private function getmBaseUrl($url)
 {
    LUrl::getBaseUrl($url); 
 }
public function getfiftyUrl() 
{
  $crt = new CDbCriteria; 
  $crt->select = "$this->getmBaseUrl(t.website)"; 
  $crt->order = 'id DESC'; 
  return new CActiveDataProvider($this, array( 'criteria' => $crt,'pagination' => array( 'pageSize' => 10, ), ));
}