zoukankan      html  css  js  c++  java
  • Yii 1.1 请求报400错误

    Yii的action可以带参数,比如:

    1 class PostController extends CController
    2 {
    3     public function actionCreate($category, $language='en')
    4     {
    5         $category=(int)$category;
    6 
    7         // ... fun code starts here ...
    8     }
    9 }

    这样确实很方便。不过,这默认只从$_GET中提取参数的。如果是post请求,就会报400错误。

    如果想使用其他类型的请求参数,可以重写CController的getActionParams()方法:

    /**
     * Returns the request parameters that will be used for action parameter binding.
     * By default, this method will return $_GET. You may override this method if you
     * want to use other request parameters (e.g. $_GET+$_POST).
     * @return array the request parameters to be used for action parameter binding
     * @since 1.1.7
     */
    public function getActionParams()
    {
        return $_GET;
    }
  • 相关阅读:
    too many open files linux服务器 golang java
    fasthttp 文档手册
    syncer.go
    grpc.go
    stm.go
    session.go
    mutex.go
    [HTML5]label标签使用以及建议
    禁止使用finalize方法
    [支付宝]手机网站支付快速接入
  • 原文地址:https://www.cnblogs.com/royhoo/p/5508823.html
Copyright © 2011-2022 走看看