講師回答 / 上班偷偷打醬油
Cats模型沒有定義吧,問題描述詳細一點不然沒法解答
講師回答 / 上班偷偷打醬油
看下 common\models 下面的PostModel模型是不是沒生成
已采納回答 / 孟源運
<...code...>server?? ? {?? ? ? ? listen ?80;?? ? ? ? server_name blog.app; ? ? ? ? ? ? #綁定域名?? ? ? ? index index.htm index.html index.php; ?#默認文件?? ? ? ? root /Users/guiyun/Code/blog.app/frontend/web; ?...
2017-08-17
已采納回答 / 明日復明日
if?($res)????????????????throw?new?\Exception("關聯(lián)保存失敗");因該是if?(!$res), 錯誤才返回異常
已采納回答 / 明日復明日
render(),第二個參數(shù)是鍵值對數(shù)組控制器通過該數(shù)組將數(shù)據(jù)傳遞給視圖,數(shù)組鍵為視圖變量名,數(shù)組值在視圖中通過引用相應的數(shù)組鍵變量名可獲取使用。在view中,例如<p><?= $model></p>,不要誤以為views中拿到的是['model' => $model, 'cat' => $cat]中的$model。這里的model是第二個參數(shù)的數(shù)組鍵'model' 在視圖文件中作為變量名 $model使用,引用輸出的結(jié)果是第二個參數(shù)的數(shù)組值。
已采納回答 / dahumk
不用配置suffix’=>'.html'啊,http://frontend.hyii2.com/gii? 進不去嗎?
已采納回答 / 渣渣一只螺
這個不是很簡單嗎,放在common里的話就是前臺frontend和后臺backend都可以使用,如果放在frontend里就只能前臺使用,類推,放在backend的話就只能后臺使用
最贊回答 / Um
在組件里添加條件。$tags = Yii::$app->request->get('tag');if($tags) { ? ?$tag = new PtModel(); ? ?$post_id = $tag->getPostid($tags); ? ?if ($post_id) { ? ? ? ?foreach ($post_id as $v) { ? ? ? ? ? ?$id[] = $v['post_id']; ? ? ? ?} ? ? ? ?$cond = ['id' => ...
2017-03-16