本文整理匯總了PHP中response::set_key方法的典型用法代碼示例。如果您正苦於以下問題:PHP response::set_key方法的具體用法?PHP response::set_key怎麽用?PHP response::set_key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類response
的用法示例。
在下文中一共展示了response::set_key方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fopen
if (DEBUG) {
$fd = fopen('debug.txt', 'a');
fwrite($fd, print_r($_POST, true));
fwrite($fd, print_r($_FILES, true));
fwrite($fd, print_r($debug_msgs, true));
fclose($fd);
}
$response = new response();
switch ($cmd) {
case 'login':
login($_POST['uname'], $_POST['password']);
break;
case 'fetch-albums':
list_albums();
break;
case 'fetch-album-images':
list_images($_POST['set_albumName']);
break;
case 'add-item':
add_image($_POST['set_albumName'], $_FILES['userfile']['name'], $_POST['caption']);
break;
case 'new-album':
// There is a title field as well, but since Plogger doesn't use it, we drop it
gr_add_album($_POST['set_albumName'], $_POST['newAlbumTitle'], $_POST['newAlbumDesc']);
break;
default:
$response->set_key('status', GR_STAT_UNKNOWN_CMD);
$response->set_key('status_text', 'Unknown command.');
}
$response->write();
close_db();
示例2: isset
$cmd = isset($_POST["cmd"]) ? $_POST["cmd"] : "";
if (DEBUG) {
$fd = fopen("debug.txt", "a");
fwrite($fd, print_r($_POST, true));
fwrite($fd, print_r($_FILES, true));
fwrite($fd, print_r($debug_msgs, true));
fclose($fd);
}
$response = new response();
switch ($cmd) {
case "login":
login($_POST["uname"], $_POST["password"]);
break;
case "fetch-albums":
list_albums();
break;
case "fetch-album-images":
list_images($_POST["set_albumName"]);
break;
case "add-item":
add_image($_POST["set_albumName"], $_FILES["userfile"]["name"], $_POST["caption"]);
break;
case "new-album":
// there is a title field as well, but since plogger doesn't use it, we drop it
gr_add_album($_POST["set_albumName"], $_POST["newAlbumTitle"], $_POST["newAlbumDesc"]);
break;
default:
$response->set_key("status", GR_STAT_UNKNOWN_CMD);
$response->set_key("status_text", "Unknown command.");
}
$response->write();