本文整理汇总了PHP中Render::json方法的典型用法代码示例。如果您正苦于以下问题:PHP Render::json方法的具体用法?PHP Render::json怎么用?PHP Render::json使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Render
的用法示例。
在下文中一共展示了Render::json方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evaluate
public function evaluate($params = [])
{
$params['scripting'] = Util::get_scripting()[intval(@$params['scriptingi'])];
$model = Record::allow($params, ['name', 'email', 'phone', 'company', 'url', 'scripting']);
$where = [implode(' = ? AND ', array_keys($model)) . ' = ?'] + $model;
$evaluator = Evaluator::read(['*'], TRUE, $where);
$today = gmdate('Y-m-d');
$update = ['agreement_date' => $today, 'email_date' => $today, 'ip' => $_SERVER['REMOTE_ADDR'], 'opt_out' => 0];
if (isset($evaluator['id'])) {
Evaluator::update($update, $evaluator['id']);
$evaluator += $update;
} else {
$model['`key`'] = Evaluator::get_unique_key($model);
$model += $update;
$evaluator = Evaluator::create($model);
$evaluator['key'] = $evaluator['`key`'];
unset($evaluator['`key`']);
}
$body = Template::render_doc_by_name('evaluate-email', $evaluator);
$args = ['toname' => $evaluator['name'], 'toemail' => $evaluator['email'], 'fromname' => 'WinWrap Support', 'fromemail' => 'support@mail.winwrap.com', 'subject' => 'WinWrap Basic Evaluation', 'body' => $body];
if (GoogleMail::send($args) === true) {
unset($evaluator['id']);
Render::json($evaluator);
} else {
header('Status: 500');
}
}
示例2: create_one
public function create_one($params = [])
{
Session::permit_admin();
$class = Filter::controller_model(get_called_class());
$item = $class::create(Record::allow($params, ['name', 'title']));
Render::json($class::read(['*'], $item['id']));
}
示例3: asset
public function asset($params = [])
{
$assets = [];
$dir = UPLOADS . 'general/' . $params['collection_name'];
if (is_dir($dir)) {
foreach (scandir($dir) as $path) {
if ($path[0] != '.') {
$assets[] = $path;
}
}
}
Render::json($assets);
}
示例4: order_custom
public function order_custom($params = [])
{
$parts = Part::get_parts();
$order = Record::allow($params, array_keys($parts));
$key = Quote::get_unique_key([]);
$model['`key`'] = $key;
$fields = ['company', 'address', 'country', 'billing_name', 'billing_email', 'billing_phone', 'technical_name', 'technical_email', 'discount', 'discount_desc'];
$model += Record::allow($params, $fields);
$quote = Quote::create($model);
$total = 0;
foreach ($order as $name => $value) {
if ($value) {
$model = ['quote_id' => $quote['id'], 'part' => $name, 'override' => null, 'quantity' => $value];
QuoteItem::create($model);
}
}
return Render::json(['key' => $key]);
}
示例5: create_one
public function create_one($params)
{
Session::permit_admin();
global $_PST;
Render::json(User::create($_PST));
}
示例6: version
public function version($params = [])
{
$contents = DocContent::read(['*'], FALSE, ['doc_id = ?', $params['doc_id']], 'updated DESC');
Render::json(array_slice($contents, 0, 10));
}
示例7: debug
public function debug($args)
{
$render = new Render();
$render->json(array('internal_args' => $args, 'post' => $this->post('debug', 'none'), 'post' => $this->get('debug', 'none'), 'post' => $this->pick('debug', 'none')));
}
示例8: get_nav
public function get_nav($params = [])
{
header('Cache-Control: max-age=288000');
Render::json(Reference::navigation());
}