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


PHP Server::process方法代碼示例

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


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

示例1: testFailGet

 /**
  * @depends     testPost
  * @expectedException   \\Exception\Request
  * @expectedExceptionCode   404
  */
 public function testFailGet($location)
 {
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['SERVER_NAME'] = 'localhost';
     $_SERVER['SERVER_PORT'] = 80;
     $_SERVER['REQUEST_URI'] = str_replace('http://localhost', '', substr($location, 0, -1));
     $server = new \Server(__DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'server', '/files/', array('prefix' => 'php-tus-test-'));
     $response = $server->process(false);
 }
開發者ID:Orajo,項目名稱:zf2-tus-server,代碼行數:15,代碼來源:ServerTest.php

示例2: array

        $list_product_info = $this->get_package_from(self::DB_VARIABLE_NAME);
        //call method convert list product into json
        if (!is_null($list_product_info)) {
            $json_data = $this->jsonEncoder->list_import_product_to_json_data($list_product_info);
        } else {
            $json_data = array();
            $json_data['error'] = 'No data';
            $json_data = json_encode($json_data);
        }
        //response with the data encode with json, status 200 = OK
        $this->response($json_data, 200);
    }
}
//Server will work indepently. These code is to start the server
$server = new Server();
$server->process();
// $data = array();
// $data['query'] = "Đ";
//TEST($server->get_list_of_import_product_info());
// $user_info = array('username' => 'ltkmai','password' =>'870814');
// $server->check_user_login(json_encode($user_info));
// $tmp = new SoldProduct(113);
//    $tmp->add_attribute("Sữa",100,new Unit("hộp",10000), "SUA1111",
//    		new Trademark("RH11221",
//    			new BasicInfo("Hồ Hữu Phát","hhphat@apcs.vn","0906332121","4 ABCD")
//    			,"Việt Nam","google.com.vn"
//    		)
//    		,"17/11/2015");
//    $BasicInfo = new BasicInfo("Kim Nhật Thành","knthanh@apcs.vn","0923232121","4 ABCD");
//    $receipt = new Receipt(1,1,new Employee("31313",$BasicInfo,10000,1,"1313131"), new Customer($BasicInfo));
//    $receipt->add($tmp);
開發者ID:Ruyka,項目名稱:Tam-An-Food-Store-Manager,代碼行數:31,代碼來源:Server.php

示例3: header

    ini_set('display_errors', 1);
    error_reporting(E_ALL);
}
if ($_SERVER['REQUEST_METHOD'] !== "POST") {
    header("HTTP/1.1 303 See other");
    header("Location: http://sblam.com");
    die("See http://sblam.com");
}
set_time_limit(20);
require_once "dbconn.php";
require_once "class/server.php";
try {
    $config = Server::getDefaultConfig();
    $services = new SblamServices(sblambaseconnect($config));
    $server = new Server($config, $services);
    $server->process(new ServerRequest($services->getDB()));
} catch (ServerException $e) {
    if (!headers_sent()) {
        header("HTTP/1.1 " . $e->getCode() . " " . $e->getMessage());
        header("Content-Type: text/plain;charset=UTF-8");
    }
    die($e->getMessage());
} catch (Exception $e) {
    if (!headers_sent()) {
        header("HTTP/1.1 500 err");
        header("Content-Type: text/plain;charset=UTF-8");
    }
    if (ini_get('display_errors')) {
        echo $e;
    } else {
        echo "Error";
開發者ID:bitemyapp,項目名稱:Sblam,代碼行數:31,代碼來源:index.php


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