當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Driver::delete方法代碼示例

本文整理匯總了PHP中Driver::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Driver::delete方法的具體用法?PHP Driver::delete怎麽用?PHP Driver::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Driver的用法示例。


在下文中一共展示了Driver::delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: driver_controller


//.........這裏部分代碼省略.........
                    }
                }
                $userid = $session['userid'];
                $result = $driver->add($userid, $driverid, $description);
                $valid = true;
            } else {
                $valid = false;
                $error = "Request contains no data via csv, json or data tag";
            }
            if (!$valid) {
                $result = "Error: {$error}\n";
            }
        }
        /*
        if ($route->action == "clean") $result = $input->clean($session['userid']);
        */
        if ($route->action == "list") {
            $result = $driver->getlist($session['userid']);
        }
        //allocate a node
        if ($route->action == "nodes") {
            $result = $driver->driversNodes($session['userid']);
        }
        if ($route->action == "release" or $route->action == "connect") {
            if (isset($_GET['json'])) {
                $datain = get('json');
                $json = preg_replace('/[^\\w\\s-.: ,]/', '', $datain);
                $datapairs = explode(',', $json);
                for ($i = 0; $i < count($datapairs); $i++) {
                    $keyvalue = explode(':', $datapairs[$i]);
                    //echo $keyvalue[0]." ".$keyvalue[1];
                    if (isset($keyvalue[1])) {
                        if ($keyvalue[0] == 'driverID') {
                            $driverid = $keyvalue[1];
                        } else {
                            if ($keyvalue[0] == 'nodeID') {
                                $nodeid = $keyvalue[1];
                            }
                        }
                    }
                }
                if ($route->action == "release") {
                    $result = $driver->release($session['userid'], $driverid, $nodeid);
                } else {
                    $result = $driver->connect($session['userid'], $driverid, $nodeid);
                }
            } else {
                $result = -1;
            }
        }
        if ($route->action == "reserve") {
            if (isset($_GET['driverID'])) {
                $result = $driver->reserve($session['userid'], $_GET['driverID']);
            } else {
                $result = -1;
            }
        }
        //get parameters of a driver
        if ($route->action == "parameters") {
            if (isset($_GET['driverid'])) {
                $result = $driver->get_parameters($_GET['driverid']);
            }
        }
        if ($route->action == "startstop") {
            if (isset($_GET['driverid'])) {
                $result = $driver->startstop($_GET['driverid']);
            }
        }
        /*
            if ($route->action == "getinputs") $result = $input->get_inputs($session['userid']);
        */
        if (isset($_GET['driverid']) && $driver->belongs_to_user($session['userid'], get("driverid"))) {
            if ($route->action == "delete") {
                $result = $driver->delete($session['userid'], get("driverid"));
            }
            if ($route->action == 'set') {
                $result = $driver->set_fields(get('driverid'), get('fields'));
            }
            if ($route->action == 'setparameters') {
                $result = $driver->set_parameters(get('driverid'), get('fields'));
            }
            /*
                  if ($route->action == "process")
                  { 
                    if ($route->subaction == "add") $result = $input->add_process($process,$session['userid'], get('inputid'), get('processid'), get('arg'), get('newfeedname'), get('newfeedinterval'));
                    if ($route->subaction == "list") $result = $input->get_processlist_desc($process, get("inputid"));
                    if ($route->subaction == "delete") $result = $input->delete_process(get("inputid"),get('processid'));
                    if ($route->subaction == "move") $result = $input->move_process(get("inputid"),get('processid'),get('moveby'));
                    if ($route->subaction == "reset") $result = $input->reset_process(get("inputid"));
                  }
                  * */
        }
        if (isset($_GET['parameterid'])) {
            if ($route->action == 'set') {
                $result = $driver->set_parameter(get('parameterid'), get('fields'));
            }
        }
    }
    return array('content' => $result);
}
開發者ID:UbiCollab,項目名稱:PersuasiveCommunities,代碼行數:101,代碼來源:driver_controller.php

示例2: catch

        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('PUT /v1/main/driver/@id', function ($id) {
    try {
        $object = Driver::update($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('DELETE /v1/main/driver/@id', function ($id) {
    try {
        $object = Driver::delete($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
//=============================================================================
//Field
//=============================================================================
Flight::route('GET /v1/main/field', function () {
    try {
        $array = Field::selectAll();
        Flight::ok($array);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
開發者ID:rhalf,項目名稱:app_track,代碼行數:31,代碼來源:main.php


注:本文中的Driver::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。