当前位置: 首页>>代码示例>>PHP>>正文


PHP Driver::release方法代码示例

本文整理汇总了PHP中Driver::release方法的典型用法代码示例。如果您正苦于以下问题:PHP Driver::release方法的具体用法?PHP Driver::release怎么用?PHP Driver::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Driver的用法示例。


在下文中一共展示了Driver::release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: driver_controller


//.........这里部分代码省略.........
                    if (isset($keyvalue[1])) {
                        if ($keyvalue[0] != 'type' or $keyvalue[0] != 'description') {
                            $valid = false;
                            $error = "Format error, json key missing or invalid character";
                        }
                        if ($keyvalue[0] == 'type') {
                            $driverid = $keyvalue[1];
                        } else {
                            $description = $keyvalue[1];
                        }
                    }
                }
                $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;
            }
开发者ID:UbiCollab,项目名称:PersuasiveCommunities,代码行数:67,代码来源:driver_controller.php


注:本文中的Driver::release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。