当前位置: 首页>>代码示例>>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;未经允许,请勿转载。