简体   繁体   中英

cant get data was Post from android to Yii2 action

I have a problem when I post data from android to Yii2 action, I have actionAdd in controller Like this

    public function actionAdd()
{
    $model = new Orders();

    if( isset($_POST['orders_id']) && isset($_POST['orders_uid']) && isset($_POST['orders_bid']) && 
        isset($_POST['orders_sid']) && isset($_POST['orders_quantity']) && isset($_POST['orders_cost']) && 
        isset($_POST['orders_discount']) && isset($_POST['orders_date']) && isset($_POST['orders_sync_status'])){
        $model->orders_id           = $_POST['orders_id'];
        $model->orders_uid          = $_POST['orders_uid'];
        $model->orders_bid          = $_POST['orders_bid'];
        $model->orders_sid          = $_POST['orders_sid'];
        $model->orders_quantity     = $_POST['orders_quantity'];
        $model->orders_cost         = $_POST['orders_cost'];
        $model->orders_discount     = $_POST['orders_discount'];
        $model->orders_date         = $_POST['orders_date'];
        $model->orders_sync_status  = $_POST['orders_sync_status'];

        $model->save(false);
    }
}

And in my android app I set this URL

HttpPost httppost = new HttpPost("http://192.168.101.147/yii/mobile_orders/backend/web/orders/add");

when I post I think its not go to action, Since I try to create simple php page on the server and Im get a POST data Truth, Also Im try to set actionAdd code in index.php under web yii2 root, and its work fine .. but when I try use action page, Im not get any data .. any help ^_^

thanks

您可以在运行的应用程序下设置操作代码,这将起作用(例如index.php获取代码并对其进行设置,它将起作用..但是我确定这不是一个好的解决方案)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM