本文整理匯總了PHP中model::setKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP model::setKey方法的具體用法?PHP model::setKey怎麽用?PHP model::setKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model
的用法示例。
在下文中一共展示了model::setKey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setKeys
/**
* Replace all substring occurences by another one in every keys on node and sub nodes.
* @param {Integer} $id node index
* @param {String} $old old substring value to replace
* @param {String} $new new substring value
*/
static function setKeys($id, $old, $new)
{
$keys = model::keys($id);
foreach ($keys as $key => $value) {
model::setKey($id, $key, str_replace($old, $new, $value));
}
$children = model::children($id);
for ($i = 0; $i < sizeof($children); $i++) {
model::setKeys($children[$i], $old, $new);
}
return true;
}
示例2: json_encode
// HTTP errors don't work with ajaxupload - we send error 200 then a response != true
//header("HTTP/1.1: 304 Not Modified Asset Not updated");
//
//echo "is_uploaded_file returned false. Possible break attempt";
echo json_encode('The file upload failed, the asset was not updated');
exit;
}
if (!assets::asset_upload(arg("id"), $path, arg("message"))) {
//
// HTTP errors don't work with ajaxupload - we send error 200 then a response != true
//header("HTTP/1.1: 304 Not Modified Asset Not updated");
//
echo json_encode('The file upload failed, the asset was not updated');
exit;
}
model::setKey(arg('id'), 'bytes', $_FILES['file']['size']);
//
// The result must be true for ajaxupload.js
//
echo json_encode(true);
break;
case "version_backup":
$path = model::getKey(arg('id'), 'file');
if (!file_exists($assetsLCL . $path)) {
header("HTTP/1.1: 404 Not Found");
echo "File " . $path . " not found";
exit;
}
if (!is_readable($assetsLCL . $path)) {
header("HTTP/1.1: 403 Forbidden");
echo "The file is not readable";