本文整理汇总了PHP中Req::args方法的典型用法代码示例。如果您正苦于以下问题:PHP Req::args方法的具体用法?PHP Req::args怎么用?PHP Req::args使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Req
的用法示例。
在下文中一共展示了Req::args方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
public function before($obj = null)
{
// 推荐商户设置 add by t-btei 2015/05/04
$companyId = Req::args('companyId');
if (isset($companyId)) {
// 保存推荐ID
setcookie('company_affiliate_uid', $companyId);
}
//测试平板或者手机端主题
$clientType = Chips::clientType();
if ($clientType == 'tablet' || $clientType == 'mobile') {
$config_path = APP_CODE_ROOT . 'config/config.php';
$config = (require $config_path);
if (isset($config['themes_mobile'])) {
$themes_mobile = Tiny::app()->setTheme($config['themes_mobile']);
} else {
Tiny::app()->setTheme("default");
}
}
$config = Config::getInstance();
$site = $config->get('globals');
$other = $config->get('other');
$currency_symbol = isset($other['other_currency_symbol']) ? $other['other_currency_symbol'] : '¥';
$site_logo = isset($site['site_logo']) && $site['site_logo'] != '' ? $site['site_logo'] : 'static/images/logo.png';
$site_qr = isset($site['site_qr']) && $site['site_qr'] != '' ? $site['site_qr'] : 'static/images/qr-app.png';
$site_name = isset($site['site_name']) ? $site['site_name'] : 'TinyShop商城';
$site_icp = isset($site['site_icp']) ? $site['site_icp'] : '鲁ICP备00000100号';
$obj->assign('currency_symbol', $currency_symbol);
$obj->assign('site_logo', $site_logo);
$obj->assign('site_qr', $site_qr);
$obj->assign('site_name', $site_name);
$obj->assign('site_icp', $site_icp);
}
示例2: getViewPath
/**
* 取得视图路径
*
* @access public
* @return String
*/
public function getViewPath()
{
if ($this->viewPath === null) {
if (!is_null(Req::args($this->viewParam))) {
$this->resolveView(Req::args($this->viewParam));
} else {
$this->viewPath = strtolower($this->getController()->id) . DIRECTORY_SEPARATOR . strtr($this->id, '.', '/');
}
}
return $this->viewPath;
}
示例3: run
/**
* action 运行入口
*
* @access public
* @return mixed
*/
public function run()
{
$controller = $this->getController();
$methodName = preg_split("/_(?=(save|del|edit)\$)/i", $this->getId());
if (count($methodName) == 2) {
$op = $methodName[1];
$modelName = $methodName[0];
} else {
$op = $methodName[0];
$modelName = $controller->getId();
}
$operator = array('save' => 'save', 'del' => 'delete', 'edit' => 'find');
//如果配制文件存在curd函数自动进行处理
if ($controller->getAutoActionRight() && array_key_exists($op, $operator)) {
if ($op == 'save') {
$pre_validator = $modelName . '_validator';
if (method_exists($controller, $pre_validator)) {
$validator = $controller->{$pre_validator}();
if (is_array($validator)) {
$data = Req::args() + array('validator' => $validator);
$controller->redirect($modelName . '_edit', false, $data);
exit;
}
}
}
$model = new Model($modelName);
$data = $model->data(Req::args())->{$operator}[$op]();
switch ($op) {
case 'save':
if ($data !== false) {
$controller->redirect($modelName . '_list');
} else {
$controller->redirect($modelName . '_edit', null, false, array('form' => $model->find()));
}
break;
case 'del':
$controller->redirect($modelName . '_list');
break;
case 'edit':
$data = isset($data) ? $data : array();
$controller->redirect($modelName . '_edit', false, $data);
break;
}
} else {
$action = new ViewAction($controller, $this->getId());
$action->run();
//exit;
}
}
示例4: brand_list
function brand_list()
{
$condition = Req::args("condition");
$condition_str = Common::str2where($condition);
if ($condition_str) {
$where = $condition_str;
} else {
$where = "1=1";
}
$this->assign("condition", $condition);
$this->assign("where", $where);
$this->redirect();
}
示例5: getRequestedView
/**
* 取得请求视图文件
*
* @access public
* @return mixed
*/
public function getRequestedView()
{
if ($this->viewPath === null) {
if (!is_null(Req::args($this->viewParam))) {
$this->viewPath = Req::args($this->viewParam);
} else {
$this->viewPath = $this->defaultView;
}
}
return $this->viewPath;
}
示例6: checkProductTax
public function checkProductTax()
{
$ship_id = Req::args("ship_id");
$real_price = Filter::float(Req::args("real_price"));
$tax_type_percent = Filter::float(Req::args("tax_type_percent"));
$num = Filter::int(Req::args("num"));
$tax_amount = $this->checkProductTax_p($ship_id, $real_price, $tax_type_percent, $num);
$data = array('taxAmount' => $tax_amount);
echo JSON::encode($data);
}
示例7: change_wel_open
public function change_wel_open()
{
$id = Req::args("id");
$is_open = Req::args("is_open");
$model = new Model("wel");
$model->data(array('is_open' => $is_open))->where("id={$id}")->update();
echo JSON::encode(array('status' => 'success'));
}
示例8: examine_list
public function examine_list()
{
$condition = Req::args("condition");
$condition = str_replace(" ", "--", $condition);
$condition_str = Common::str2where($condition);
if ($condition_str) {
$this->assign("where", $condition_str);
} else {
$approve = Req::args("approve");
if ($approve) {
$this->assign("where", "approve_result='" . $approve . "'");
} else {
$this->assign("where", "1=1");
}
}
$this->assign("condition", $condition);
$this->redirect();
}
示例9: createTable
/**
* 创建表
*
* @access public
* @return mixed
*/
public function createTable()
{
$table = Req::args('table');
if ($table !== null) {
$model = new Model($table);
}
}
示例10: order_getlist
public function order_getlist()
{
$order_no = Filter::int(Req::args('order_no'));
$order_inst = Order::getOrderWithDetailByNo($order_no);
// echo JSON::encode($retData,JSON_UNESCAPED_SLASHES);
echo json_encode($order_inst, JSON_UNESCAPED_SLASHES);
}
示例11: save
/**
* 保存数据,自动识别更新还是添加
*
* @access public
* @return mixed
*/
public function save()
{
if (!is_array($this->sql['data']) || count($this->sql['data']) < 1) {
$this->sql['data'] = Req::args();
}
if (isset($this->sql['data'][$this->primary_key]) && $this->sql['data'][$this->primary_key]) {
return $this->update();
} else {
if (isset($this->sql['data'][$this->primary_key])) {
unset($this->sql['data'][$this->primary_key]);
}
return $this->insert();
}
}
示例12: voucher_create
public function voucher_create()
{
$id = Req::args("id");
$start_time = Req::args("start_time");
$start_time = $start_time == null ? date("Y-m-d") : $start_time;
$end_time = Req::args("end_time");
$end_time = $end_time == null ? date("Y-m-d 23:59:59", strtotime("+30 days")) : date("Y-m-d 23:59:59", strtotime($end_time));
$model = new Model('voucher_template');
$voucher_template = $model->where("id = {$id}")->find();
if ($voucher_template) {
$voucher_model = new Model('voucher');
$num = Req::args('num');
$i = 0;
while ($i < $num) {
do {
$account = strtoupper(CHash::random(10, 'char'));
$password = strtoupper(CHash::random(10, 'char'));
$voucher_template['account'] = $account;
$voucher_template['password'] = $password;
$voucher_template['start_time'] = $start_time;
$voucher_template['end_time'] = $end_time;
$obj = $voucher_model->where("account = '{$account}'")->find();
} while ($obj);
unset($voucher_template['id'], $voucher_template['point']);
$voucher_model->data($voucher_template)->insert();
$i++;
}
}
echo JSON::encode(array('status' => 'success', 'msg' => '已成功生成[' . $voucher_template['name'] . ']代金券(' . $num . ')张'));
}
示例13: async_callback
function async_callback()
{
//从URL中获取支付方式
$payment_id = Filter::int(Req::get('payment_id'));
$payment = new Payment($payment_id);
$paymentPlugin = $payment->getPaymentPlugin();
if (!is_object($paymentPlugin)) {
echo "fail";
}
//初始化参数
$money = '';
$message = '支付失败';
$orderNo = '';
//执行接口回调函数
$callbackData = Req::args();
//array_merge($_POST,$_GET);
unset($callbackData['con']);
unset($callbackData['act']);
unset($callbackData['payment_id']);
$return = $paymentPlugin->callback($callbackData, $payment_id, $money, $message, $orderNo);
//支付成功
if ($return == 1) {
//充值方式
if (stripos($orderNo, 'recharge_') !== false) {
$tradenoArray = explode('_', $orderNo);
$recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
if (Order::recharge($recharge_no, $payment_id, $callbackData)) {
$paymentPlugin->asyncStop();
exit;
}
} else {
$order_id = Order::updateStatus($orderNo, $payment_id, $callbackData);
if ($order_id) {
$paymentPlugin->asyncStop();
exit;
}
}
}
}
示例14: calendar
private function calendar()
{
$cal = array();
$s_time = Req::args("s_time");
if (!$s_time) {
$s_time = date("Y-m-d -- Y-m-d");
}
$date = explode(' -- ', $s_time);
$stime = date('Y-m-d 00:00:00', strtotime($date[0]));
$etime = date('Y-m-d 00:00:00', strtotime($date[1] . '+1day'));
$cle = strtotime($etime) - strtotime($stime);
$num = ceil($cle / 86400);
$cal['start'] = $stime;
$cal['end'] = $etime;
$cal['days'] = $num;
$cal['str'] = $s_time;
return $cal;
}
示例15: check
/**
* 安规则的标尺进行验证
*
* @access public
* @param array $rules 如 array('title:required|int:标题不能为空!);
* @param mixed $data
* @return bool
*/
public static function check($rules, $data = null)
{
if ($data == null) {
$data = Req::args();
}
foreach ($rules as $rule) {
list($name, $reg, $msg) = explode(':', $rule);
$info = array('name' => $name, 'msg' => $msg);
$field = isset($data[$name]) ? $data[$name] : null;
if (strpos($reg, '|') !== false) {
$regs = explode('|', $reg);
foreach ($regs as $reg) {
if (method_exists('Validator', $reg)) {
if (!self::$reg($field)) {
return $info;
}
} else {
if (!self::match($reg, $field)) {
return $info;
}
}
}
} else {
if (method_exists('Validator', $reg)) {
if (!self::$reg($field)) {
return $info;
}
} else {
if (!self::match($reg, $field)) {
return $info;
}
}
}
}
return true;
}