本文整理匯總了PHP中url_rewrite函數的典型用法代碼示例。如果您正苦於以下問題:PHP url_rewrite函數的具體用法?PHP url_rewrite怎麽用?PHP url_rewrite使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了url_rewrite函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tpl_modifier_qishi_url
function tpl_modifier_qishi_url($string)
{
global $_CFG;
if (strpos($string, ",")) {
$val = explode(",", $string);
if ($val[0] == "QS_user") {
return get_member_url($val[1], true);
} else {
if (strpos($val[1], "-")) {
$g = explode("-", $val[1]);
if (!empty($g)) {
foreach ($g as $v) {
$vs = explode(":", $v);
$getarray[$vs[0]] = $vs[1];
}
}
} else {
$g = explode(":", $val[1]);
$getarray[$g[0]] = $g[1];
}
return url_rewrite($val[0], $getarray);
}
} else {
return url_rewrite($string);
}
}
示例2: tpl_function_qishi_news_show
function tpl_function_qishi_news_show($params, &$smarty)
{
global $db, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "資訊ID":
$aset['id'] = $a[1];
break;
case "列表名":
$aset['listname'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
unset($arr, $str, $a, $params);
$sql = "select id,subsite_id,content,title,seo_keywords,seo_description,type_id,addtime from " . table('article') . " WHERE id=" . intval($aset['id']) . " AND is_display=1 LIMIT 1";
$val = $db->getone($sql);
if (empty($val)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
}
check_url($val['subsite_id'], $smarty, $_CFG['news_url']);
$val['content'] = htmlspecialchars_decode($val['content'], ENT_QUOTES);
if ($val['seo_keywords'] == "") {
$val['keywords'] = $val['title'];
} else {
$val['keywords'] = $val['seo_keywords'];
}
if ($val['seo_description'] == "") {
$val['description'] = cut_str(strip_tags($val['content']), 60, 0, "");
} else {
$val['description'] = $val['seo_description'];
}
if (intval($_CFG['subsite_id']) > 0) {
$other_wheresql = " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
}
$prev = $db->getone("select id,subsite_id,title from " . table('article') . " where id<" . $val['id'] . " and type_id=" . $val['type_id'] . $other_wheresql . " order by id desc limit 1");
if (!$prev) {
$val['prev'] = 0;
} else {
$val['prev'] = 1;
$val['prev_title'] = $prev['title'];
$val['prev_url'] = url_rewrite("QS_newsshow", array('id' => $prev['id']), 1, $prev['subsite_id']);
}
$next = $db->getone("select id,subsite_id,title from " . table('article') . " where id>" . $val['id'] . " and type_id=" . $val['type_id'] . $other_wheresql . " limit 1");
if (!$next) {
$val['next'] = "沒有了";
} else {
$val['next'] = 1;
$val['next_title'] = $next['title'];
$val['next_url'] = url_rewrite("QS_newsshow", array('id' => $next['id']), 1, $next['subsite_id']);
}
$smarty->assign($aset['listname'], $val);
}
示例3: tpl_function_qishi_curriculum_show
function tpl_function_qishi_curriculum_show($params, &$smarty)
{
global $db, $timestamp, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "¿Î³ÌID":
$aset['id'] = $a[1];
break;
case "ÁбíÃû":
$aset['listname'] = $a[1];
break;
case "ÃèÊö³¤¶È":
$aset['brieflylen'] = $a[1];
break;
case "Ìî²¹×Ö·û":
$aset['dot'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
$wheresql = " WHERE id={$aset['id']} ";
$sql = "select id,subsite_id,uid,setmeal_deadline,add_mode,train_id,contents,refreshtime,teacher_id,teacher_cn,trainname,course_name,addtime,click,favour_expenses,train_expenses,classhour,category_cn,starttime,classtype_cn,district_cn,train_object,train_certificate from " . table('course') . $wheresql . " LIMIT 1";
$val = $db->getone($sql);
if (empty($val)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
} else {
check_url($val['subsite_id'], $smarty, $_CFG['train_url']);
if ($val['setmeal_deadline'] < time() && $val['setmeal_deadline'] != "0" && $val['add_mode'] == "2") {
$val['deadline'] = $val['setmeal_deadline'];
}
$val['course_url'] = url_rewrite('QS_courseshow', array('id' => $val['id']), 1, $val['subsite_id']);
$profile = GetTainProfile($val['train_id']);
$val['train'] = $profile;
$val['expire'] = sub_day($val['deadline'], time());
$val['countapply'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('personal_course_apply') . " WHERE course_id= '{$val['id']}'");
if ($aset['brieflylen'] > 0) {
$val['briefly'] = cut_str(strip_tags($val['contents']), $aset['brieflylen'], 0, $aset['dot']);
} else {
$val['briefly'] = strip_tags($val['contents']);
}
$val['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300");
$val['train_url'] = url_rewrite('QS_train_agencyshow', array('id' => $val['train_id']));
$val['teacher_url'] = url_rewrite('QS_train_lecturershow', array('id' => $val['teacher_id']));
if ($val['train']['logo']) {
$val['train']['logo'] = $_CFG['site_dir'] . "data/train_logo/" . $val['train']['logo'];
} else {
$val['train']['logo'] = $_CFG['site_dir'] . "data/train_logo/no_logo.gif";
}
}
$smarty->assign($aset['listname'], $val);
}
示例4: get_resume_list
function get_resume_list($offset, $perpage, $get_sql = '')
{
global $db;
$limit = " LIMIT " . $offset . ',' . $perpage;
$result = $db->query($get_sql . $limit);
while ($row = $db->fetch_array($result)) {
$row['resume_url'] = url_rewrite('QS_resumeshow', array('id' => $row['id']));
$row_arr[] = $row;
}
return $row_arr;
}
示例5: tpl_function_qishi_company_show
function tpl_function_qishi_company_show($params, &$smarty)
{
global $db, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "企業ID":
$aset['id'] = $a[1];
break;
case "企業介紹長度":
$aset['companynamelen'] = $a[1];
break;
case "列表名":
$aset['listname'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
$aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 50;
$wheresql .= " AND user_status=1 ";
$sql = "select id,uid,contents,website,logo,companyname,audit,address,map_open,map_x,map_y,map_zoom,resume_processing,nature_cn,trade_cn,scale_cn,district_cn from " . table('company_profile') . " WHERE id='{$aset['id']}' {$wheresql} LIMIT 1";
$profile = $db->getone($sql);
if (empty($profile)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
} else {
$profile['company_url'] = url_rewrite('QS_companyshow', array('id' => $profile['id']));
$profile['company_profile'] = htmlspecialchars_decode($profile['contents'], ENT_QUOTES);
// 在招職位
$profile['jobs_num'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('jobs') . " WHERE uid='{$profile['uid']}' ");
// 感興趣簡曆
$profile['resume_num'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('company_favorites') . " WHERE company_uid='{$profile['uid']}' ");
if ($profile['website']) {
if (strstr($profile['website'], "http://") === false) {
$profile['website'] = "http://" . $profile['website'];
}
}
if ($profile['logo']) {
$profile['logo'] = $_CFG['site_dir'] . "data/logo/" . $profile['logo'];
} else {
$profile['logo'] = $_CFG['site_dir'] . "data/logo/no_logo.gif";
}
$row = $db->getone("select * from " . table("members_setmeal") . " where uid = " . $profile['uid']);
$profile['pay_user'] = $row['setmeal_id'];
$profile['pay_setmeal_name'] = $row['setmeal_name'];
require_once QISHI_ROOT_PATH . 'include/fun_user.php';
$profile['loginlog'] = get_loginlog_one($profile['uid'], '1001');
}
$smarty->assign($aset['listname'], $profile);
}
示例6: get_evaluation_paper
function get_evaluation_paper($offset, $perpage, $sql = '')
{
global $db, $_CFG;
$limit = " LIMIT " . $offset . ',' . $perpage;
$rows = $db->getall("SELECT * FROM " . table('evaluation_paper') . $sql . $limit);
foreach ($rows as $key => $value) {
$value['url'] = url_rewrite('QS_paper_answer', array('id' => $value['id']));
$list[$key] = $value;
}
return $list;
}
示例7: tpl_function_qishi_train_show
function tpl_function_qishi_train_show($params, &$smarty)
{
global $db, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "機構ID":
$aset['id'] = $a[1];
break;
case "列表名":
$aset['listname'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
$wheresql .= " AND user_status=1 ";
$sql = "select id,uid,contents,website,logo,trainname,address,nature_cn,district_cn,founddate from " . table('train_profile') . " WHERE id='{$aset['id']}' {$wheresql} LIMIT 1";
$profile = $db->getone($sql);
if (empty($profile)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
} else {
$profile['train_url'] = url_rewrite('QS_train_agencyshow', array('id' => $profile['id']));
$profile['train_profile'] = $profile['contents'];
$profile['description'] = cut_str(strip_tags($profile['contents']), 50, 0, "...");
$wheresql = " WHERE train_id='{$profile['id']}' and audit='1' ";
$profile['countresume'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('train_news') . $wheresql);
$profile['countjob'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('course') . $wheresql);
/* 機構 風采圖片 start */
$profile['train_img_num'] = $db->get_total("SELECT COUNT(*) AS num FROM " . table('train_img') . " WHERE uid='{$profile['uid']}' and audit=1 ");
$train_img = $db->getall("select img from " . table("train_img") . " WHERE uid='{$profile['uid']}' and audit=1 order by addtime desc ");
$profile['train_img'] = $train_img[0]['img'];
foreach ($train_img as $key => $value) {
$train_img[$key] = $_CFG['site_domain'] . $_CFG['site_dir'] . "data/train_img/original/" . $value['img'];
}
$profile['train_img_big'] = $train_img;
/* 機構 風采圖片 end */
if ($profile['website']) {
if (strstr($profile['website'], "http://") === false) {
$profile['website'] = "http://" . $profile['website'];
}
}
if ($profile['logo']) {
$profile['logo'] = $_CFG['site_dir'] . "data/train_logo/" . $profile['logo'];
} else {
$profile['logo'] = $_CFG['site_dir'] . "data/train_logo/no_logo.gif";
}
}
$smarty->assign($aset['listname'], $profile);
}
示例8: get_help
function get_help($offset, $perpage, $sql = '')
{
global $db;
$row_arr = array();
$limit = " LIMIT " . $offset . ',' . $perpage;
$result = $db->query("SELECT a.*,c.id as cid,c.categoryname as c_categoryname FROM " . table('help') . " AS a {$sql} {$limit}");
while ($row = $db->fetch_array($result)) {
$row['url'] = url_rewrite('QS_helpshow', array('id' => $row['id']));
$row_arr[] = $row;
}
return $row_arr;
}
示例9: get_nav_one
function get_nav_one($id)
{
global $db;
$id = intval($id);
$sql = "select * from " . table('navigation') . " where id=" . $id;
$category_one = $db->getone($sql);
if ($category_one['systemclass'] == "1") {
$category_one['url'] = url_rewrite($category_one['module'], $category_one['module_page']);
}
$category_one['url_str'] = cut_str($category_one['url'], 12, 0);
return $category_one;
}
示例10: tpl_function_qishi_train_lecturer_show
function tpl_function_qishi_train_lecturer_show($params, &$smarty)
{
global $db, $timestamp, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "½²Ê¦ID":
$aset['id'] = $a[1];
break;
case "ÁбíÃû":
$aset['listname'] = $a[1];
break;
case "ÃèÊö³¤¶È":
$aset['brieflylen'] = $a[1];
break;
case "Ìî²¹×Ö·û":
$aset['dot'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
$wheresql = " WHERE id={$aset['id']} ";
$sql = "select id,train_id,contents,birthdate,refreshtime,photo,photo_img,teachername,education_cn,graduated_school,speciality,work_unit,positionaltitles,district_cn,achievements from " . table('train_teachers') . $wheresql . " LIMIT 1";
$val = $db->getone($sql);
if (empty($val)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
} else {
$profile = GetTainProfile($val['train_id']);
$val['train'] = $profile;
if ($aset['brieflylen'] > 0) {
$val['briefly'] = cut_str(strip_tags($val['contents']), $aset['brieflylen'], 0, $aset['dot']);
} else {
$val['briefly'] = strip_tags($val['contents']);
}
$val['age'] = date('Y') + 1 - $val['birthdate'];
$val['refreshtime_cn'] = daterange(time(), $val['refreshtime'], 'Y-m-d', "#FF3300");
$val['train_url'] = url_rewrite('QS_train_agencyshow', array('id' => $val['train_id']));
$val['teacher_url'] = url_rewrite('QS_train_lecturer', array('id' => $val['id']));
if ($val['photo'] == "1") {
$val['photosrc'] = $_CFG['teacher_photo_dir'] . $val['photo_img'];
} else {
$val['photosrc'] = $_CFG['teacher_photo_dir'] . "no_photo.gif";
}
}
$smarty->assign($aset['listname'], $val);
}
示例11: reading_list_news
function reading_list_news()
{
global $db, $enrolled_courses, $system_courses;
$news = array();
$sql = "SELECT * FROM " . TABLE_PREFIX . "reading_list R INNER JOIN " . TABLE_PREFIX . "external_resources E ON E.resource_id = R.resource_id WHERE R.course_id in " . $enrolled_courses . " ORDER BY R.reading_id DESC";
$result = mysql_query($sql, $db);
if (@mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$news[] = array('time' => $row['date_end'], 'object' => $row, 'alt' => _AT('reading_list'), 'course' => $system_courses[$row['course_id']]['title'], 'thumb' => 'images/home-reading_list_sm.png', 'link' => '<a href="' . url_rewrite('mods/_standard/reading_list/display_resource.php?id=' . $row['resource_id'], AT_PRETTY_URL_IS_HEADER) . '"' . (strlen($row['title']) > SUBLINK_TEXT_LEN ? ' title="' . $row['title'] . '"' : '') . '>' . validate_length($row['title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) . '</a>');
}
}
return $news;
}
示例12: tpl_function_qishi_company_show
function tpl_function_qishi_company_show($params, &$smarty)
{
global $db, $_CFG;
$arr = explode(',', $params['set']);
foreach ($arr as $str) {
$a = explode(':', $str);
switch ($a[0]) {
case "企業ID":
$aset['id'] = $a[1];
break;
case "企業介紹長度":
$aset['companynamelen'] = $a[1];
break;
case "列表名":
$aset['listname'] = $a[1];
break;
}
}
$aset = array_map("get_smarty_request", $aset);
$aset['id'] = $aset['id'] ? intval($aset['id']) : 0;
$aset['listname'] = $aset['listname'] ? $aset['listname'] : "list";
$aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 50;
$wheresql .= " AND user_status=1 ";
$sql = "select * from " . table('company_profile') . " WHERE id='{$aset['id']}' {$wheresql} LIMIT 1";
$profile = $db->getone($sql);
if (empty($profile)) {
header("HTTP/1.1 404 Not Found");
$smarty->display("404.htm");
exit;
} else {
$profile['company_url'] = url_rewrite('QS_companyshow', array('id' => $profile['id']));
$profile['company_profile'] = $profile['contents'];
$profile['description'] = cut_str(strip_tags($profile['contents']), $aset['companynamelen'], 0, "...");
$deslength = strlen($profile['description']);
$conlength = strlen($profile['contents']);
if ($deslength < $conlength) {
$profile['ishow'] = 1;
}
if ($profile['website']) {
if (strstr($profile['website'], "http://") === false) {
$profile['website'] = "http://" . $profile['website'];
}
}
if ($profile['logo']) {
$profile['logo'] = $_CFG['main_domain'] . "data/logo/" . $profile['logo'];
} else {
$profile['logo'] = $_CFG['main_domain'] . "data/logo/no_logo.gif";
}
}
$smarty->assign($aset['listname'], $profile);
}
示例13: getSimpleList
/**
* 根據條件獲到評論列表
* 當limit與offset都為0時,表示不行限製
* 當is_attachment為真時,需要查尋評論的圖片列表,以及評論會員基本信息
*/
public function getSimpleList($limit = 0, $offset = 0, $order_by = '')
{
if (empty($order_by)) {
$order_by = "ca.id desc";
}
$where = "c.status=1 and c.has_image=1 and c.delete_flg=0 and c.type='PRODUCT'";
$group = 'c.relation_id';
$comment_list = $this->db->table("Comment as c")->join('Comment_attachment as ca ON ca.cid=c.id', 'LEFT')->where($where)->group($group)->limit($offset . ',' . $limit)->field("c.*,ca.file,ca.width,ca.height,c.relation_id")->select();
foreach ($comment_list as $k => $tmp) {
$comment_list[$k]['file'] = getAttachmentUrl($tmp['file']);
$comment_list[$k]['ilink'] = url_rewrite('goods:index', array('id' => $tmp['relation_id'])) . "#product_comment_image";
}
return $comment_list;
}
示例14: get_notice
function get_notice($offset, $perpage, $get_explain_sql = '')
{
global $db;
$row_arr = array();
$limit = " LIMIT " . $offset . ',' . $perpage;
$result = $db->query("SELECT n.*,c.categoryname FROM " . table('notice') . " AS n" . $get_explain_sql . $limit);
while ($row = $db->fetch_array($result)) {
$tit_color = $row['tit_color'] ? "color:" . $row['tit_color'] . ";" : '';
$tit_b = $row['tit_b'] > 0 ? "font-weight:bold;" : '';
$tit_style = $tit_color || $tit_b ? "style=\"" . $tit_color . $tit_b . "\"" : '';
$url = $row['is_url'] == "http://" ? url_rewrite('QS_noticeshow', array('id' => $row['id'])) : $row['is_url'];
$row['url_title'] = "<a href=\"" . $url . "\" target=\"_blank\" " . $tit_style . ">" . $row['title'] . "</a> ";
$row_arr[] = $row;
}
return $row_arr;
}
示例15: getSellingCouponProduct
/**
* 根據優惠券商品 查找對應產品信息列表
* @param $where is string
* @param $orderbyfield 排序字段
* @param $orderbymethod 排序方式 ASC DESC
* @param $offset
* @param $limit
* @return array
*/
public function getSellingCouponProduct($where, $order_by_field, $order_by_method, $offset, $limit)
{
if (!empty($order_by_field) && !empty($order_by_method)) {
$order = $order_by_field . ' ' . strtoupper($order_by_method);
} else {
//默認排序
$order = 'p.sort DESC, p.product_id DESC';
}
$where = $where . " and p.status=1";
$products = $this->db->table("Coupon_to_product as cp")->join('Product as p ON cp.product_id=p.product_id', 'LEFT')->where($where)->order($order)->limit($offset . ',' . $limit)->field("p.*,cp.coupon_id")->select();
foreach ($products as &$tmp) {
$tmp['image'] = getAttachmentUrl($tmp['image']);
$tmp['link'] = url_rewrite('goods:index', array('id' => $tmp['product_id']));
}
return $products;
}