POST表单400错误: 正确做法: Add this in the head section of your layout: <?= Html::csrfMetaTags() ?> --------------------------------- 不推荐的做法,以下做法是取消CSRF令牌验证: Add this in your controller: public $enableCsrfValidation = false; 别的方法: 原来是csrf验证的问题,因为表单是自己写的,在Y…
Yii的action可以带参数,比如: class PostController extends CController { public function actionCreate($category, $language='en') { $category=(int)$category; // ... fun code starts here ... } } 这样确实很方便.不过,这默认只从$_GET中提取参数的.如果是post请求,就会报400错误. 如果想使用其他类型的请求参数,可以重写…