本文整理汇总了PHP中IReq::set方法的典型用法代码示例。如果您正苦于以下问题:PHP IReq::set方法的具体用法?PHP IReq::set怎么用?PHP IReq::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReq
的用法示例。
在下文中一共展示了IReq::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beginUrl
/**
* @brief 获取url参数
* @param String url 需要分析的url,默认为当前url
*/
public static function beginUrl($url = '')
{
//四种
//native: /index.php?controller=blog&action=read&id=100
//pathinfo:/blog/read/id/100
//native-pathinfo:/index.php/blog/read/id/100
//diy:/blog-100.html
$obj = IServerVars::factory($_SERVER['SERVER_SOFTWARE']);
$url = !empty($url) ? $url : $obj->realUri();
preg_match('/\\.php(.*)/', $url, $phpurl);
if (!isset($phpurl[1]) || !$phpurl[1]) {
if ($url != "") {
//强行赋值
//todo:检测是否有bug
$phpurl = array(1 => "?");
} else {
return;
}
}
$url = $phpurl[1];
$urlArray = array();
$rewriteRule = isset(IWeb::$app->config['rewriteRule']) ? IWeb::$app->config['rewriteRule'] : 'native';
if ($rewriteRule != 'native') {
$urlArray = self::decodeRouteUrl($url);
}
if ($urlArray == array()) {
if ($url[0] == '?') {
$urlArray = $_GET;
} else {
$urlArray = self::pathinfoToArray($url);
}
}
if (isset($urlArray[self::UrlCtrlName])) {
$tmp = explode('-', $urlArray[self::UrlCtrlName]);
if (count($tmp) == 2) {
IReq::set('module', $tmp[0]);
IReq::set(self::UrlCtrlName, $tmp[1]);
} else {
IReq::set(self::UrlCtrlName, $urlArray[self::UrlCtrlName]);
}
}
if (isset($urlArray[self::UrlActionName])) {
IReq::set(self::UrlActionName, $urlArray[self::UrlActionName]);
if (IReq::get('action') == 'run') {
IReq::set('action', null);
}
}
unset($urlArray[self::UrlActionName], $urlArray[self::UrlActionName], $urlArray[self::Anchor]);
foreach ($urlArray as $key => $value) {
IReq::set($key, $value);
}
}
示例2: order_message
/**
* @brief 保存顾客留言
*/
public function order_message()
{
//获得post数据
$order_id = IFilter::act(IReq::get('order_id'), 'int');
$user_id = IFilter::act(IReq::get('user_id'), 'int');
$title = IFilter::act(IReq::get('title'));
$content = IFilter::act(IReq::get('content'), 'text');
//获得message的表对象
$tb_message = new IModel('message');
$tb_message->setData(array('title' => $title, 'content' => $content, 'time' => date('Y-m-d H:i:s')));
$message_id = $tb_message->add();
//获的mess类
$message = new Mess($user_id);
$message->writeMessage($message_id);
IReq::set('id', $order_id);
$this->order_show();
}
示例3: order_accept
/**
* 修改收件人信息
* */
public function order_accept()
{
$id = IFilter::act(IReq::get('order_id'), 'int');
$mess = '';
if ($id) {
$order_array = array('postcode' => IFilter::act(IReq::get('postcode')), 'accept_name' => IFilter::act(IReq::get('accept_name')), 'province' => IFilter::act(IReq::get('province')), 'city' => IFilter::act(IReq::get('city')), 'area' => IFilter::act(IReq::get('area')), 'school' => IFilter::act(IReq::get('school')), 'address' => IFilter::act(IReq::get('address')), 'telphone' => IFilter::act(IReq::get('telphone')), 'mobile' => IFilter::act(IReq::get('mobile')));
$tb_order = new IModel('order');
$orderRow = $tb_order->getObj('id = ' . $id);
//比对省份是否改变,从而重新计算运费
if ($order_array['province'] != $orderRow['province']) {
//获取订单物品重量
$goods_weight = IFilter::act(IReq::get('goods_weight'), 'float');
//调入数据,获得配送方式结果
$deliveryData = Delivery::getDelivery($order_array['province'], $goods_weight);
//所选择的省份不能送达
if ($deliveryData[$orderRow['distribution']]['if_delivery'] == 1) {
$mess = '对不起,该地区不能送达,请您重新选择省份';
} else {
if ($deliveryData[$orderRow['distribution']]['price'] != $orderRow['payable_freight']) {
$order_array['payable_freight'] = $deliveryData[$orderRow['distribution']]['price'];
//非免运费
if ($orderRow['real_freight'] > 0) {
$order_array['real_freight'] = $order_array['payable_freight'];
//修正订单最终总金额
$order_array['order_amount'] = $orderRow['order_amount'] + $order_array['payable_freight'] - $orderRow['real_freight'];
}
}
}
}
//无错误信息运行正常
if ($mess == '') {
$mess = '更新成功!';
$tb_order->setData($order_array);
if ($tb_order->update('id = ' . $id . ' and user_id = ' . $this->user['user_id']) === false) {
$mess = '收件人更新失败!';
}
}
} else {
$mess = '您的操作失败!';
}
IReq::set('id', $id);
$this->order_detail();
Util::showMessage($mess);
}
示例4: order_accept
/**
* 修改收件人信息
* */
public function order_accept()
{
$id = IFilter::act(IReq::get('order_id'), 'int');
$freight = IReq::get('freight_real');
$mess = '您的操作成功!';
if ($id) {
$tb_order = new IModel('order');
$order_array = array('accept_name' => IFilter::act(IReq::get('accept_name')), 'province' => IFilter::act(IReq::get('province')), 'city' => IFilter::act(IReq::get('city')), 'area' => IFilter::act(IReq::get('area')), 'address' => IFilter::act(IReq::get('address')), 'telphone' => IFilter::act(IReq::get('telphone')), 'mobile' => IFilter::act(IReq::get('mobile')), 'real_freight' => IFilter::act(IReq::get('freight_real')), 'order_amount' => IFilter::act(IReq::get('order_total')));
$tb_order->setData($order_array);
if ($tb_order->update('id=' . $id) === false) {
$mess = '收件人更新失败!';
}
} else {
$mess = '您的操作失败!';
}
IReq::set('id', $id);
$this->order_detail();
Util::showMessage($mess);
}