本文整理汇总了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);
}
示例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);
示例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";