本文整理汇总了PHP中response::getLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP response::getLocation方法的具体用法?PHP response::getLocation怎么用?PHP response::getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类response
的用法示例。
在下文中一共展示了response::getLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCode
class error
{
public $code = "";
public function getCode()
{
return $this->code;
}
}
$output = new response();
$err = new error();
//SQL query goes here
//Location is default to "BC", Days is defaulted to 5,
//Desease is defauled to 'flu'
$output->diseasetype = "flu";
$output->location = "BC";
$sql = "SELECT infected FROM " . $output->getLocation() . " WHERE deseasetype = '" . $output->getDiseasetype() . "' LIMIT 5";
$result = $conn->query($sql);
//JSON parsing and echo go here
if ($result->num_rows == 5) {
while ($r = $result->fetch_assoc()) {
$output->arrayInfected[] = $r;
}
echo json_encode($output);
} else {
$err->code = "Something went wrong";
echo json_encode($err);
}
$conn->close;
?>