本文整理匯總了PHP中model::search方法的典型用法代碼示例。如果您正苦於以下問題:PHP model::search方法的具體用法?PHP model::search怎麽用?PHP model::search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model
的用法示例。
在下文中一共展示了model::search方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: arg
include_once "lib/http_service.php";
include_once "lib/model_json.php";
damas_service::init_http();
damas_service::accessGranted();
damas_service::allowed("model::" . arg("cmd"));
if (!arg("cmd")) {
header("HTTP/1.1: 400 Bad Request");
echo "Bad command";
exit;
}
header('Content-type: application/json');
$ret = false;
switch (arg("cmd")) {
/* SCRUD operations */
case "search":
echo json_encode(model::search(json_decode(arg("keys")), arg("sortby"), arg("order"), arg("limit")));
break;
case "create":
if (is_null(arg('keys'))) {
header("HTTP/1.1: 400 Bad Request");
echo "Bad command";
exit;
}
$id = model::create(json_decode(arg("keys")));
if (!$id) {
header("HTTP/1.1: 409 Conflict");
echo "create Error, please change your values";
exit;
}
echo json_encode(model_json::node($id, 1, $NODE_TAG | $NODE_PRM));
break;
示例2: children
/**
* Retrieve the children of a node
* @param {Integer} $id node index
* @return {Array} array of children ids
*/
static function children($id)
{
$res = array();
// PROTOTYPE BEGIN
$protoname = model::getKey($id, 'prototype');
if ($protoname) {
$proto = model::searchKey('id', $protoname);
$proto = $proto[0];
if ($proto) {
$res = model::children($proto);
}
}
// PROTOTYPE END
return $res + model::search(array('#parent' => '= ' . $id));
}
示例3: header
echo $msg . '. No change made.';
exit;
}
if (!is_uploaded_file($file['tmp_name'])) {
header("HTTP/1.1: 409 Conflict");
echo $file['name'] . ": is_uploaded_file returned false. Possible break attempt. No change made.";
exit;
}
$dir = '';
$path = '';
$id = '';
if (model::getKey(arg('id'), 'dir')) {
// we are in a dir
$dir = model::getKey(arg('id'), 'dir');
$path = $dir . '/' . $file['name'];
$id = array_shift(model::search(array('file' => "='" . $path . "'")));
} else {
$path = model::getKey(arg('id'), 'file');
$dir = dirname($path);
$id = arg('id');
}
$error_detected = false;
if (!is_writable($assetsLCL . $dir)) {
$error_detected = true;
$msg .= $dir . " is not writable. ";
}
if ($id) {
// replacement checks
switch (model::getKey($id, 'mode')) {
case '1':
default: