本文整理匯總了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);
}