本文整理汇总了PHP中Web::makeError方法的典型用法代码示例。如果您正苦于以下问题:PHP Web::makeError方法的具体用法?PHP Web::makeError怎么用?PHP Web::makeError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Web
的用法示例。
在下文中一共展示了Web::makeError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authed
function authed()
{
return isset($_SESSION["adminid"]);
}
}
$app = new Web(array("debug" => false));
$app->add(new Slim\Middleware\ContentTypes());
$app->notFound(function () use($app) {
echo "Requested resource not found";
});
$app->get("/", function () use($app) {
$app->redirect("/");
});
$app->get("/plans", function () use($app) {
if (!$app->authed()) {
$app->makeError("Access denied");
return;
}
$qres = mysql_query("SELECT * FROM `tblproducts` p WHERE p.`type` IN ( 'hostingaccount','reselleraccount') and p.`configoption1` != '' and p.`servertype` = 'cpanel';");
if ($qres === FALSE) {
$app->makeError("Unable to get the list of hosting packages");
return;
}
$plans = array();
while (($row = mysql_fetch_assoc($qres)) !== FALSE) {
$plans[] = array("id" => intval($row["id"]), "label" => $row["name"], "description" => $row["description"], "name" => $row["configoption1"], "limits" => array("ftp" => intval($row["configoption2"]), "disk" => intval($row["configoption3"]), "email" => intval($row["configoption4"]), "bandwidth" => intval($row["configoption5"]), "dedicated_ip" => onoffval($row["configoption6"]), "ssh" => onoffval($row["configoption7"]), "databases" => intval($row["configoption8"]), "cgi" => onoffval($row["configoption9"]), "subdomains" => intval($row["configoption10"]), "frontpage" => onoffval($row["configoption11"]), "parked" => intval($row["configoption12"]), "addon" => intval($row["configoption14"]), "overage" => strval($row["overagesenabled"][0]) === "1"));
}
echo json_encode($plans);
});
$app->post("/update", function () use($app) {
if (!$app->authed()) {