當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Render::json方法代碼示例

本文整理匯總了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');
     }
 }
開發者ID:wileybenet,項目名稱:mobile-docs,代碼行數:27,代碼來源:evaluate_ctrl.php

示例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']));
 }
開發者ID:wileybenet,項目名稱:mobile-docs,代碼行數:7,代碼來源:ctrl.php

示例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);
 }
開發者ID:wileybenet,項目名稱:mobile-docs,代碼行數:13,代碼來源:asset_ctrl.php

示例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]);
 }
開發者ID:wileybenet,項目名稱:mobile-docs,代碼行數:18,代碼來源:product_ctrl.php

示例5: create_one

 public function create_one($params)
 {
     Session::permit_admin();
     global $_PST;
     Render::json(User::create($_PST));
 }
開發者ID:wileybenet,項目名稱:mobile-docs,代碼行數:6,代碼來源:user_ctrl.php

示例6: version

 public function version($params = [])
 {
     $contents = DocContent::read(['*'], FALSE, ['doc_id = ?', $params['doc_id']], 'updated DESC');
     Render::json(array_slice($contents, 0, 10));
 }
開發者ID:wileybenet,項目名稱:mobile-docs,代碼行數:5,代碼來源:doc_ctrl.php

示例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')));
 }
開發者ID:entreoutros,項目名稱:Topo,代碼行數:5,代碼來源:homeController.class.php

示例8: get_nav

 public function get_nav($params = [])
 {
     header('Cache-Control: max-age=288000');
     Render::json(Reference::navigation());
 }
開發者ID:wileybenet,項目名稱:mobile-docs,代碼行數:5,代碼來源:reference_ctrl.php


注:本文中的Render::json方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。