当前位置: 首页>>代码示例>>PHP>>正文


PHP URLEncode函数代码示例

本文整理汇总了PHP中URLEncode函数的典型用法代码示例。如果您正苦于以下问题:PHP URLEncode函数的具体用法?PHP URLEncode怎么用?PHP URLEncode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了URLEncode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sanitize_uri

function sanitize_uri()
{
    global $PATH_INFO, $SCRIPT_NAME, $REQUEST_URI;
    if (isset($PATH_INFO) && $PATH_INFO != "") {
        $SCRIPT_NAME = $PATH_INFO;
        $REQUEST_URI = "";
    }
    if ($REQUEST_URI == "") {
        //necessary for some IIS installations (CGI in particular)
        $get = httpallget();
        if (count($get) > 0) {
            $REQUEST_URI = $SCRIPT_NAME . "?";
            reset($get);
            $i = 0;
            while (list($key, $val) = each($get)) {
                if ($i > 0) {
                    $REQUEST_URI .= "&";
                }
                $REQUEST_URI .= "{$key}=" . URLEncode($val);
                $i++;
            }
        } else {
            $REQUEST_URI = $SCRIPT_NAME;
        }
        $_SERVER['REQUEST_URI'] = $REQUEST_URI;
    }
    $SCRIPT_NAME = substr($SCRIPT_NAME, strrpos($SCRIPT_NAME, "/") + 1);
    if (strpos($REQUEST_URI, "?")) {
        $REQUEST_URI = $SCRIPT_NAME . substr($REQUEST_URI, strpos($REQUEST_URI, "?"));
    } else {
        $REQUEST_URI = $SCRIPT_NAME;
    }
}
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:33,代码来源:php_generic_environment.php

示例2: export

 function export()
 {
     $model = M("Customer");
     $where['is_del'] = 0;
     $list = $model->where($where)->select();
     Vendor('Excel.PHPExcel');
     //导入thinkphp第三方类库
     $inputFileName = "Public/templete/customer.xlsx";
     $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
     $objPHPExcel->getProperties()->setCreator("smeoa")->setLastModifiedBy("smeoa")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
     // Add some data
     $i = 1;
     //dump($list);
     foreach ($list as $val) {
         $i++;
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $val["name"])->setCellValue("B{$i}", $val["short"])->setCellValue("C{$i}", $val["biz_license"])->setCellValue("D{$i}", $val["payment"])->setCellValue("E{$i}", $val["address"])->setCellValue("F{$i}", $val["salesman"])->setCellValue("G{$i}", $val["contact"])->setCellValue("H{$i}", $val["email"])->setCellValue("I{$i}", $val["office_tel"])->setCellValue("J{$i}", $val["mobile_tel"])->setCellValue("J{$i}", $val["fax"])->setCellValue("L{$i}", $val["im"])->setCellValue("M{$i}", $val["remark"]);
     }
     // Rename worksheet
     $objPHPExcel->getActiveSheet()->setTitle('Customer');
     // Set active sheet index to the first sheet, so Excel opens this as the first sheet
     $objPHPExcel->setActiveSheetIndex(0);
     $file_name = "customer.xlsx";
     // Redirect output to a client’s web browser (Excel2007)
     header("Content-Type: application/force-download");
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header("Content-Disposition:attachment;filename =" . str_ireplace('+', '%20', URLEncode($file_name)));
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     exit;
 }
开发者ID:2ger,项目名称:trunk,代码行数:31,代码来源:CustomerAction.class.php

示例3: asides_dohook

function asides_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "viewcommentary":
            $tloc = get_module_pref("loc", "commentaryinfo");
            $sloc = get_module_pref("loc", "commentaryinfo", $args['acctid']);
            break;
        case "commentaryoptions":
            if (!strpos($_SERVER['REQUEST_URI'], "char=" . $session['user']['acctid'] . "&")) {
                $link = "bio.php?char=" . $session['user']['acctid'] . "&ret=" . URLEncode($_SERVER['REQUEST_URI']);
                $total = get_module_pref("total");
                $seen = get_module_pref("seen");
                output("`n`n<a href=\"{$link}\">View my Bio</a>", true);
                if ($seen != $total) {
                    $new = $total - $seen;
                    if ($new == 1) {
                        output("(1 unread Natter)");
                    } else {
                        output("(%s unread Natters)", $new);
                    }
                }
                addnav("", $link);
            }
            break;
    }
    return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:28,代码来源:asides.php

示例4: viewmybio_dohook

function viewmybio_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "commentaryoptions":
            $link = "bio.php?char=" . $session['user']['acctid'] . "&ret=" . URLEncode($_SERVER['REQUEST_URI']);
            output("`n`n<a href=\"{$link}\">View my Bio</a>", true);
            addnav("", $link);
            break;
    }
    return $args;
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:12,代码来源:viewmybio.php

示例5: biochat_dohook

function biochat_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "bioend":
            require_once "lib/commentary.php";
            output("`n`n`0%s`0's Natter feed:`n", $args['name']);
            addcommentary();
            $section = "bio-" . $args['acctid'];
            viewcommentary($section, "Natter!", 25);
            if (!strpos(httpget('ret'), "bio.php")) {
                set_module_pref("lastplace", httpget('ret'));
            }
            $sql = "SELECT COUNT(commentid) AS totalcomments FROM " . db_prefix("commentary") . " WHERE section='{$section}'";
            $result = db_query($sql);
            $row = db_fetch_assoc($result);
            $all = $row['totalcomments'];
            set_module_pref("total", $all, "biochat", $args['acctid']);
            if ($args['acctid'] == $session['user']['acctid']) {
                //this is the player looking at his or her own bio
                set_module_pref("seen", $all);
            }
            $return = get_module_pref("lastplace");
            if ($return) {
                $return = substr($return, strrpos($return, "/") + 1);
                addnav("Been clicking around Bios and Nattering for a while?");
                addnav("Go `iright`i back to where you came from", $return);
            }
            debug($return);
            break;
        case "commentaryoptions":
            if (!strpos($_SERVER['REQUEST_URI'], "char=" . $session['user']['acctid'] . "&")) {
                $link = "bio.php?char=" . $session['user']['acctid'] . "&ret=" . URLEncode($_SERVER['REQUEST_URI']);
                $total = get_module_pref("total");
                $seen = get_module_pref("seen");
                output("<a href=\"{$link}\">View my Bio</a> ", true);
                if ($seen != $total) {
                    $new = $total - $seen;
                    if ($new == 1) {
                        output("(1 unread Natter) ");
                    } else {
                        output("(%s unread Natters) ", $new);
                    }
                }
                addnav("", $link);
            }
            break;
    }
    return $args;
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:50,代码来源:biochat.php

示例6: viewmybio_dohook

function viewmybio_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "commentaryoptions":
            require_once "lib/commentary.php";
            $link = "bio.php?char=" . $session['user']['acctid'] . "&ret=" . URLEncode(buildcommentarylink("&frombio=true", $_SERVER['REQUEST_URI']));
            debug($link);
            output("`n`n<a href=\"{$link}\">View my Bio</a>", true);
            addnav("", $link);
            break;
    }
    return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:14,代码来源:viewmybio.php

示例7: s_users_by_uids

function s_users_by_uids(&$uids, $encoded = false)
{
    if (!s_bad_array($uids) || !($uids = array_unique($uids)) || !($uids = array_values($uids)) || empty($uids)) {
        return false;
    }
    //看cache中是否存在
    asort($uids);
    $mem = mem_cache_share();
    $key = md5(MEM_CACHE_KEY_PREFIX . "_user_by_uids_" . implode(",", $uids) . strval($encoded));
    if ($data = $mem->get($key)) {
        //缓存中已经存在
        $data = json_decode($data, true);
    }
    if (!$data) {
        //缓存中没有,请求服务器
        $max = 20;
        $time = 0;
        $times = ceil(count($uids) / $max);
        $list = array();
        do {
            $ids = array();
            $num0 = $time * $max;
            $num1 = ($time + 1) * $max - 1;
            foreach (range($num0, $num1) as $index) {
                if (!isset($uids[$index]) || intval($uids[$index]) <= 0) {
                    break;
                }
                $ids[] = $uids[$index];
            }
            $params = array("uids" => implode(",", $ids), "source" => APP_KEY, "cookie" => array("SUE" => $_COOKIE["SUE"], "SUP" => $_COOKIE["SUP"]));
            $data = s_http_get();
            $req = new HTTP_Request('http://i2.api.weibo.com/2/users/show_batch.json');
            $req->setMethod(HTTP_REQUEST_METHOD_GET);
            $req->addCookie("SUE", URLEncode($_COOKIE["SUE"]));
            $req->addCookie("SUP", URLEncode($_COOKIE["SUP"]));
            $req->addQueryString('uids', implode(",", $ids));
            $req->addQueryString('is_encoded', $encoded === false ? 0 : 1);
            $req->addQueryString('source', MBLOG_APP_KEY);
            $rs = $req->sendRequest();
            if (PEAR::isError($rs) || !($ret = json_decode($req->getResponseBody(), true)) || isset($ret["error_code"])) {
                return false;
            }
            //有可能是空数组
            if (isset($ret["users"])) {
                $list = array_merge($list, $ret["users"]);
            }
            unset($ret);
        } while (++$time < $times);
        $data = array();
        //重新组合成uid => array()
        foreach ($list as &$item) {
            if (isset($item["id"]) && $item["idstr"] > 0) {
                $data[$item["idstr"]] = $item;
            }
            unset($item);
        }
        //检查自己是否在数组中
        if (false !== ($me = login_user_info()) && ($meid = $me["uniqueid"]) && in_array($meid, $uids) && ($me = get_user_by_token(intval($meid)))) {
            $data[$me["id"]] = $me;
        }
        unset($list);
        //缓存十小时
        $mem->set($key, json_encode($data), 0, MEM_CACHE_LIFETIME_LUCKY);
    }
    return $data;
}
开发者ID:anjestar,项目名称:SHFramework,代码行数:66,代码来源:devinc.user.php

示例8: trim

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arParams["FILTER_NAME"] = trim($arParams["FILTER_NAME"]);
$arParams["LIST_URL"] = trim($arParams["LIST_URL"]);
if (strlen($arParams["FILTER_NAME"]) > 0 && strlen($arParams["LIST_URL"]) > 0) {
    foreach ($arResult["MONTH"] as $week => $arWeek) {
        foreach ($arWeek as $day => $arDay) {
            if (count($arDay["events"]) > 0) {
                $timeFROM = mktime(0, 0, 0, $arResult["currentMonth"], $arDay["day"], $arResult["currentYear"]);
                $timeTO = mktime(0, 0, 0, $arResult["currentMonth"], $arDay["day"] + 1, $arResult["currentYear"]);
                $strFROM = date($GLOBALS["DB"]->DateFormatToPHP(CLang::GetDateFormat("SHORT")), $timeFROM);
                $strTO = date($GLOBALS["DB"]->DateFormatToPHP(CLang::GetDateFormat("SHORT")), $timeTO);
                $LIST_URL = $arParams["LIST_URL"];
                if (strpos($LIST_URL, "?") === false) {
                    $LIST_URL .= "?";
                }
                if (strpos($LIST_URL, "&") !== false) {
                    $LIST_URL .= "&";
                }
                $LIST_URL .= URLEncode($arParams["FILTER_NAME"] . "[>=" . $arParams["DATE_FIELD"] . "]") . "=" . URLEncode($strFROM);
                $LIST_URL .= "&" . URLEncode($arParams["FILTER_NAME"] . "[<" . $arParams["DATE_FIELD"] . "]") . "=" . URLEncode($strTO);
                $arResult["MONTH"][$week][$day]["events"][0]["url"] = htmlspecialcharsbx($LIST_URL);
                $arResult["MONTH"][$week][$day]["events"][0]["title"] = "";
            }
        }
    }
}
开发者ID:rasuldev,项目名称:torino,代码行数:30,代码来源:result_modifier.php

示例9: _folder_export

 private function _folder_export($model, $map)
 {
     $list = $model->where($map)->select();
     //导入thinkphp第三方类库
     Vendor('Excel.PHPExcel');
     //$inputFileName = "Public/templete/contact.xlsx";
     //$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator("小微OA")->setLastModifiedBy("小微OA")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
     // Add some data
     $i = 1;
     //dump($list);
     //编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", "编号")->setCellValue("B{$i}", "类型")->setCellValue("C{$i}", "标题")->setCellValue("D{$i}", "登录时间")->setCellValue("E{$i}", "部门")->setCellValue("F{$i}", "登录人")->setCellValue("G{$i}", "状态")->setCellValue("H{$i}", "审批")->setCellValue("I{$i}", "协商")->setCellValue("J{$i}", "抄送")->setCellValue("J{$i}", "审批情况");
     foreach ($list as $val) {
         $i++;
         //dump($val);
         $id = $val['id'];
         $doc_no = $val["doc_no"];
         //编号
         $name = $val["name"];
         //标题
         $confirm_name = strip_tags($val["confirm_name"]);
         //审批
         $consult_name = strip_tags($val["consult_name"]);
         //协商
         $refer_name = strip_tags($val["refer_name"]);
         //协商
         $type_name = $val["type_name"];
         //流程类型
         $user_name = $val["user_name"];
         //登记人
         $dept_name = $val["dept_name"];
         //不美分
         $create_time = $val["create_time"];
         $create_time = toDate($val["create_time"], 'Y-m-d H:i:s');
         //创建时间
         $step = show_step_type($val["step"]);
         //
         //编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $doc_no)->setCellValue("B{$i}", $type_name)->setCellValue("C{$i}", $name)->setCellValue("D{$i}", $create_time)->setCellValue("E{$i}", $dept_name)->setCellValue("F{$i}", $user_name)->setCellValue("G{$i}", $step)->setCellValue("H{$i}", $confirm_name)->setCellValue("I{$i}", $consult_name);
         $model_flow_field = D("FlowField");
         $field_list = $model_flow_field->get_data_list($id);
         //	dump($field_list);
         $k = 0;
         if (!empty($field_list)) {
             foreach ($field_list as $field) {
                 $k++;
                 $field_data = $field['name'] . ":" . $field['val'];
                 $location = get_cell_location("J", $i, $k);
                 $objPHPExcel->setActiveSheetIndex(0)->setCellValue($location, $field_data);
             }
         }
     }
     // Rename worksheet
     $objPHPExcel->getActiveSheet()->setTitle('流程统计');
     // Set active sheet index to the first sheet, so Excel opens this as the first sheet
     $objPHPExcel->setActiveSheetIndex(0);
     $file_name = "流程统计.xlsx";
     // Redirect output to a client’s web browser (Excel2007)
     header("Content-Type: application/force-download");
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header("Content-Disposition:attachment;filename =" . str_ireplace('+', '%20', URLEncode($file_name)));
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     //readfile($filename);
     $objWriter->save('php://output');
     exit;
 }
开发者ID:zqstudio2015,项目名称:smeoa,代码行数:69,代码来源:FlowAction.class.php

示例10: commentaryinfo_dohook

function commentaryinfo_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "viewcommentary":
            if (get_module_pref("user_usecommentaryextras") == 0) {
                break;
            }
            if (preg_match('/bio\\.php\\?char=(\\d+)\\&ret/', $args['commentline'], $matches)) {
                $userid = $matches[1];
            }
            if ($userid == 0) {
                if (get_module_pref("user_linebreak") == 1) {
                    rawoutput("<br />");
                }
                break;
            }
            $sql = "SELECT race, sex, donation, weapon, loggedin, laston FROM " . db_prefix("accounts") . " WHERE acctid = {$userid}";
            $result = db_fetch_assoc(db_query_cached($sql, "commentaryinfo-{$userid}"));
            if (!get_module_pref("user_hidemyinfo", "commentaryinfo", $userid)) {
                $racefilename = strtolower($result['race']);
                $racefilename = strtr($racefilename, " '-_.!,", "");
                $racefilename = str_replace(" ", "", $racefilename);
                if ($result['sex'] == 0) {
                    $gender = "m";
                    $gendertitle = "Male";
                } else {
                    $gender = "f";
                    $gendertitle = "Female";
                }
                $racefilename .= $gender;
                $race = "<img src=\"/images/races/" . $racefilename . ".png\" alt=\"" . $gendertitle . " " . $result['race'] . "\" title=\"" . $gendertitle . " " . $result['race'] . "\">";
                $weaponfilename = strtolower($result['weapon']);
                $weaponfilename = strtr($weaponfilename, " '-_.!+1234567890,", "                  ");
                $weaponfilename = str_replace(" ", "", $weaponfilename);
                $weaponfilename = "images/weapons/" . $weaponfilename . ".png";
                if (file_exists($weaponfilename)) {
                    $weapon = "<img src=\"" . $weaponfilename . "\" alt=\"Weapon: " . $result['weapon'] . "\" title=\"Weapon: " . $result['weapon'] . "\">";
                } else {
                    $weapon = "Weapon: " . $result['weapon'];
                }
            }
            $offline = date("Y-m-d H:i:s", strtotime("-" . getsetting("LOGINTIMEOUT", 900) . " seconds"));
            if ($result['laston'] > $offline && $result['loggedin'] == 1) {
                if (get_module_pref("loc", "commentaryinfo", $userid) == get_module_pref("loc", "commentaryinfo")) {
                    $online = "<img src=\"/modules/commentaryinfo/nearby.png\" alt=\"Nearby\" title=\"Nearby\">";
                    if ($userid != $session['user']['acctid']) {
                        $ret = URLEncode($_SERVER['REQUEST_URI']);
                        if (!strpos($ret, "bio.php") && !strpos($ret, "commentaryinfo")) {
                            $online = "<a href=\"runmodule.php?module=commentaryinfo&op=closetalk&player={$userid}&ret={$ret}\"><img src=\"/modules/commentaryinfo/nearby.png\" alt=\"Nearby (click to whisper)\" title=\"Nearby (click to whisper)\"></a>";
                            addnav("", "runmodule.php?module=commentaryinfo&op=closetalk&player={$userid}&ret={$ret}");
                        }
                    }
                } else {
                    $online = "<img src=\"/modules/commentaryinfo/online.png\" alt=\"Logged In\" title=\"Logged In\">";
                }
            } else {
                $online = "<img src=\"/modules/commentaryinfo/offline.png\" alt=\"Logged Out\" title=\"Logged Out\">";
            }
            if ($result['donation'] > 100) {
                $donation = "<img src=\"/modules/commentaryinfo/donator1.png\" alt=\"Site Supporter\" title=\"Site Supporter\">";
            }
            if ($result['donation'] > 1000) {
                $donation = "<img src=\"/modules/commentaryinfo/donator2.png\" alt=\"Extra Awesome Site Supporter\" title=\"Extra Awesome Site Supporter\">";
            }
            if ($result['donation'] > 2000) {
                $donation = "<img src=\"/modules/commentaryinfo/donator3.png\" alt=\"Ultra Awesome Site Supporter\" title=\"Ultra Awesome Site Supporter\">";
            }
            if (get_module_pref("user_linebreak") == 1) {
                $out .= "<br />";
            }
            $out .= "{$online} {$close} {$race} {$donation}";
            if (get_module_pref("user_showweapons") == 1) {
                $out .= " {$weapon}";
            }
            if (get_module_pref("user_showinline") == 0) {
                $out .= "<br />";
            }
            rawoutput("{$out}");
            break;
        case "forest":
        case "worldnav":
            clear_module_pref("loc");
            break;
        case "viewcommentaryheader":
            set_module_pref("loc", $args['section']);
            invalidatedatacache("commentaryinfo-" . $session['user']['acctid']);
            break;
    }
    return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:91,代码来源:commentaryinfo.php

示例11: _book

function _book($from_Content, $fromUsername, $toUsername, $time)
{
    ini_set('default_charset', 'utf-8');
    // 1. 初始化
    /*Cache配置信息,可查询Cache详情页*/
    $cacheid = 'XXX';
    $host = 'cache.duapp.com';
    $port = '20243';
    $user = 'XXX';
    $pwd = 'XXX';
    $mc = new BaeMemcache($cacheid, $host . ': ' . $port, $user, $pwd);
    //以下的几个语句,用作拥有自定义菜单的,可以设置对书名,作者,任意词对应查询,当然需要在消息处理页面设置对应memcache
    // 2. 设置选项,包括URL
    $sch_url = "http://202.121.55.6:8080/opac/";
    $type = any;
    $shu = 120;
    curl_setopt($ch, CURLOPT_URL, $sch_url . "openlink.php?strSearchType=title&match_flag=forward&historyCount=1&strText=" . $from_Content . "&doctype=ALL&displaypg=120&showmode=list&sort=CATA_DATE&orderby=desc&location=ALL");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    // 3. 执行并获取HTML文档内容
    $output = curl_exec($ch);
    // 4. 释放curl句柄
    curl_close($ch);
    $key = $from_Content;
    $pattern = '/<table.*?>(.+?)<\\/table>/is';
    //正则表达式,不同的图书馆根据代码内容可对应修改
    preg_match($pattern, $output, $match);
    //$match[0] 即为<table></table>之间代码
    //然后再提取<tr></tr>之间的内容
    $pattern = '/<tr.*?>(.+?)<\\/tr>/is';
    preg_match_all($pattern, $match[0], $results, PREG_SET_ORDER);
    $s = $results;
    for ($i = 1; $i <= 120; $i++) {
        $pattern = '/<a href=.*?>(.+?)<\\/a>/is';
        //书名
        preg_match_all($pattern, $s[$i - 1][1], $results, PREG_SET_ORDER);
        $arr_title[$i] = html_entity_decode($results[0][1], ENT_QUOTES, 'utf-8');
        $pattern1 = '/<\\/span.*?>(.+?)<br.*?>/is';
        //作者
        preg_match_all($pattern1, $s[$i - 1][1], $results, PREG_SET_ORDER);
        $arr_zuozhe[$i] = html_entity_decode($results[1][1], ENT_QUOTES, 'utf-8');
        $preg = '/<a .*?href="(.*?)".*?>/is';
        //提取链接
        preg_match_all($preg, $s[$i - 1][1], $results, PREG_SET_ORDER);
        $arr_url[$i] = "http://202.121.55.6:8080/opac/" . $results[0][1];
    }
    memcache_set($mc, $from_Content . "_title", $arr_title);
    memcache_set($mc, $from_Content . "_zuozhe", $arr_zuozhe);
    memcache_set($mc, $from_Content . "_url", $arr_url);
    //计算出有多少结果
    $count;
    for ($i = 10; $i >= 0; $i--) {
        if ($arr_title[$i]) {
            $count = $i;
            break;
        } else {
            continue;
        }
    }
    $from_Content = URLEncode($from_Content);
    //经测试微信图文链接无法传递汉字参数
    if ($count >= 10) {
        $resultStr = "<xml>\n           <ToUserName><![CDATA[" . $fromUsername . "]]></ToUserName>\n           <FromUserName><![CDATA[" . $toUsername . "]]></FromUserName>\n<CreateTime>{$time}</CreateTime>\n<MsgType><![CDATA[news]]></MsgType>\n<ArticleCount>{$count}</ArticleCount>\n<Articles>\n<item>\n           <Title><![CDATA[1." . $arr_title[1] . "  --" . $arr_zuozhe[1] . "]]></Title> \n         <PicUrl><![CDATA[http://1.shnupartner.sinaapp.com/images/lib.png]]></PicUrl> \n         <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[1] . "&title=" . URLEncode($arr_title[1]) . "]]></Url>\n</item>\n\n<item>\n     <Title><![CDATA[2." . $arr_title[2] . "  --" . $arr_zuozhe[2] . "]]></Title> \n      \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[2] . "&title=" . URLEncode($arr_title[2]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[3." . $arr_title[3] . "  --" . $arr_zuozhe[3] . "]]></Title>   \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[3] . "&title=" . URLEncode($arr_title[3]) . "]]></Url>\n</item>\n<item>\n    <Title><![CDATA[4." . $arr_title[4] . "  --" . $arr_zuozhe[4] . "]]></Title>       \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[4] . "&title=" . URLEncode($arr_title[4]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[5." . $arr_title[5] . "  --" . $arr_zuozhe[5] . "]]></Title> \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[5] . "&title=" . URLEncode($arr_title[5]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[6." . $arr_title[6] . "  --" . $arr_zuozhe[6] . "]]></Title> \n    \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[6] . "&title=" . URLEncode($arr_title[6]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[7." . $arr_title[7] . "  --" . $arr_zuozhe[7] . "]]></Title> \n    \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[7] . "&title=" . URLEncode($arr_title[7]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[8." . $arr_title[8] . "  --" . $arr_zuozhe[8] . "]]></Title>      \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[8] . "&title=" . URLEncode($arr_title[8]) . "]]></Url>\n</item>\n<item>\n    <Title><![CDATA[9." . $arr_title[9] . "  --" . $arr_zuozhe[9] . "]]></Title> \n    \n    <Url><![CDATA[http://shnucs.duapp.com/library/lib_data.php?url=" . $arr_url[9] . "&title=" . URLEncode($arr_title[9]) . "]]></Url>\n</item>\n<item>\n    <Title><![CDATA[点击查看更多相关书籍]]></Title>\n      \n    <Url><![CDATA[http://shnucs.duapp.com/library/more.php?key=" . $from_Content . "&sch_url=" . $sch_url . "&type=" . $type . "]]></Url>\n</item>\n\n\n\n</Articles>\n</xml>  ";
        echo $resultStr;
        exit;
    } else {
        $resultStr = "<xml>\n           <ToUserName><![CDATA[" . $fromUsername . "]]></ToUserName>\n           <FromUserName><![CDATA[" . $toUsername . "]]></FromUserName>\n<CreateTime>.time().</CreateTime>\n<MsgType><![CDATA[news]]></MsgType>\n<ArticleCount>{$count}</ArticleCount>\n<Articles>\n\n<item>\n           <Title><![CDATA[1." . $arr_title[1] . "  --" . $arr_zuozhe[1] . "]]></Title> \n         <PicUrl><![CDATA[http://1.shnupartner.sinaapp.com/images/lib.png]]></PicUrl> \n         <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[1] . "&title=" . URLEncode($arr_title[1]) . "]]></Url>\n</item>\n\n<item>\n     <Title><![CDATA[2." . $arr_title[2] . "  --" . $arr_zuozhe[2] . "]]></Title> \n      \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[2] . "&title=" . URLEncode($arr_title[2]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[3." . $arr_title[3] . "  --" . $arr_zuozhe[3] . "]]></Title>   \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[3] . "&title=" . URLEncode($arr_title[3]) . "]]></Url>\n</item>\n<item>\n    <Title><![CDATA[4." . $arr_title[4] . "  --" . $arr_zuozhe[4] . "]]></Title>       \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[4] . "&title=" . URLEncode($arr_title[4]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[5." . $arr_title[5] . "  --" . $arr_zuozhe[5] . "]]></Title> \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[5] . "&title=" . URLEncode($arr_title[5]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[6." . $arr_title[6] . "  --" . $arr_zuozhe[6] . "]]></Title> \n    \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[6] . "&title=" . URLEncode($arr_title[6]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[7." . $arr_title[7] . "  --" . $arr_zuozhe[7] . "]]></Title> \n    \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[7] . "&title=" . URLEncode($arr_title[7]) . "]]></Url>\n</item>\n<item>\n     <Title><![CDATA[8." . $arr_title[8] . "  --" . $arr_zuozhe[8] . "]]></Title>      \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[8] . "&title=" . URLEncode($arr_title[8]) . "]]></Url>\n</item>\n<item>\n    <Title><![CDATA[9." . $arr_title[9] . "  --" . $arr_zuozhe[9] . "]]></Title> \n    \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[9] . "&title=" . URLEncode($arr_title[9]) . "]]></Url>\n</item>\n<item>\n    <Title><![CDATA[9." . $arr_title[10] . "  --" . $arr_zuozhe[10] . "]]></Title> \n    \n    <Url><![CDATA[http://1.shnupartner.sinaapp.com/library/lib_data.php?url=" . $arr_url[10] . "&title=" . URLEncode($arr_title[10]) . "]]></Url>\n</item>\n</Articles>\n</xml>  ";
        echo $resultStr;
        exit;
    }
}
开发者ID:JermingFan,项目名称:wechatCampus,代码行数:71,代码来源:book.php

示例12: session_start

            }
        </style>
    </head>
    <body bgcolor = "black">
            <h1>MINI WOW: <div class = "right">Welcome: <?php 
session_start();
echo $_SESSION['person'];
?>
 | 
            <a href = "wow_information.php" target = "_blank">人物信息</a> | <a class = "open_fb" >展开/收缩副本</a></div></h1>
            <?php 
header('Content-Type:text/html;charset = utf8');
include_once 'database.php';
$fb_list = mysql_query('SELECT DISTINCT Name ,Instruction FROM `FB`', $link);
while ($row = mysql_fetch_object($fb_list)) {
    echo '<h3 class = "bg">', $row->Name, '</h3>';
    echo '<div class = "bolder">';
    echo '<img class = "left" src = "/wow/wow/' . $row->Name . '.jpg" width = "300" height = "150"">';
    echo '副本名称:', $row->Name, '</br>';
    echo '副本介绍:', $row->Instruction, '</br>副本BOSS:';
    $boss = mysql_query('SELECT Name FROM `boss` WHERE FB="' . $row->Name . '"', $link);
    while ($row_boss = mysql_fetch_object($boss)) {
        echo $row_boss->Name, '  ';
    }
    echo '</br><a href = "wowenter.php?boss=' . URLEncode($row->Name) . '">点击进入</a>';
    echo '</div>';
}
?>
    </body>
<html>
开发者ID:qaz734913414,项目名称:wow,代码行数:30,代码来源:wow.php

示例13: db_fetch_assoc

    for ($i = 0; $i < $number; $i++) {
        $row = db_fetch_assoc($result);
        $site = str_replace("http://", "", $row['uri']);
        if (strpos($site, "/")) {
            $site = substr($site, 0, strpos($site, "/"));
        }
        $sql = "UPDATE " . db_prefix("referers") . " SET site='" . addslashes($site) . "' WHERE refererid='{$row['refererid']}'";
        db_query($sql);
    }
}
require_once "lib/superusernav.php";
superusernav();
addnav("Referer Options");
addnav("", $_SERVER['REQUEST_URI']);
$sort = httpget('sort');
addnav("Refresh", "referers.php?sort=" . URLEncode($sort) . "");
addnav("C?Sort by Count", "referers.php?sort=count" . ($sort == "count DESC" ? "" : "+DESC"));
addnav("U?Sort by URL", "referers.php?sort=uri" . ($sort == "uri" ? "+DESC" : ""));
addnav("T?Sort by Time", "referers.php?sort=last" . ($sort == "last DESC" ? "" : "+DESC"));
addnav("Rebuild Sites", "referers.php?op=rebuild");
page_header("Referers");
$order = "count DESC";
if ($sort != "") {
    $order = $sort;
}
$sql = "SELECT SUM(count) AS count, MAX(last) AS last,site FROM " . db_prefix("referers") . " GROUP BY site ORDER BY {$order} LIMIT 100";
$count = translate_inline("Count");
$last = translate_inline("Last");
$dest = translate_inline("Destination");
$none = translate_inline("`iNone`i");
$notset = translate_inline("`iNot set`i");
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:31,代码来源:referers.php

示例14: output

    output("`@Date: `^`b%s`b (%s)`n", $row['date'], relativedate($row['date']));
    output("`@Status: %s`n", $statuses[$row['status']]);
    if ($row['closedate'] != '0000-00-00 00:00:00') {
        output("`@Last Update: `^%s`@ on `^%s (%s)`n", $row['closer'], $row['closedate'], dhms(strtotime('now') - strtotime($row['closedate']), true));
    }
    output("`@Body:`^`n");
    $body = htmlentities(stripslashes($row['body']), ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
    $body = preg_replace("'([[:alnum:]_.-]+[@][[:alnum:]_.-]{2,}([.][[:alnum:]_.-]{2,})+)'i", "<a href='mailto:\\1?subject=RE: {$peti}&body=" . str_replace("+", " ", URLEncode("\n\n----- {$yourpeti} -----\n" . $row['body'])) . "'>\\1</a>", $body);
    $body = preg_replace("'([\\[][[:alnum:]_.-]+[\\]])'i", "<span class='colLtRed'>\\1</span>", $body);
    rawoutput("<span style='font-family: fixed-width'>" . nl2br($body) . "</span>");
    commentdisplay("`n`@Commentary:`0`n", "pet-{$id}", "Add information", 200);
    if ($viewpageinfo) {
        output("`n`n`@Page Info:`&`n");
        $row['pageinfo'] = stripslashes($row['pageinfo']);
        $body = HTMLEntities($row['pageinfo'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
        $body = preg_replace("'([[:alnum:]_.-]+[@][[:alnum:]_.-]{2,}([.][[:alnum:]_.-]{2,})+)'i", "<a href='mailto:\\1?subject=RE: {$peti}&body=" . str_replace("+", " ", URLEncode("\n\n----- {$yourpeti} -----\n" . $row['body'])) . "'>\\1</a>", $body);
        $body = preg_replace("'([\\[][[:alnum:]_.-]+[\\]])'i", "<span class='colLtRed'>\\1</span>", $body);
        rawoutput("<pre>" . nl2br($body) . "</pre>");
    }
}
if ($id && $op != "") {
    $prevsql = "SELECT p1.petitionid, p1.status FROM " . db_prefix("petitions") . " AS p1, " . db_prefix("petitions") . " AS p2\n            WHERE p1.petitionid<'{$id}' AND p2.petitionid='{$id}' AND p1.status=p2.status ORDER BY p1.petitionid DESC LIMIT 1";
    $prevresult = db_query($prevsql);
    $prevrow = db_fetch_assoc($prevresult);
    if ($prevrow) {
        $previd = $prevrow['petitionid'];
        $s = $prevrow['status'];
        $status = $statuses[$s];
        addnav("Navigation");
        addnav(array("Previous %s", $status), "viewpetition.php?op=view&id={$previd}");
    }
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:31,代码来源:viewpetition.php

示例15: saveuser

             saveuser();
             header("Location: {$session['user']['restorepage']}");
             exit;
             //redirect($session['user']['page']);//"badnav.php");
         }
         db_query("UPDATE accounts SET loggedin=" . true . ", location=0 WHERE acctid = " . $session['user']['acctid']);
         $session['user']['loggedin'] = true;
         $location = $session['user']['location'];
         $session['user']['location'] = 0;
         if ($session['user']['alive'] == 0 && $session['user']['slainby'] != "") {
             //they're not really dead, they were killed in pvp.
             $session['user']['alive'] = true;
         }
         if (getsetting("logdnet", 0)) {
             //register with LoGDnet
             @file(getsetting("logdnetserver", "http://lotgd.net/") . "logdnet.php?addy=" . URLEncode(getsetting("serverurl", "http://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']))) . "&desc=" . URLEncode(getsetting("serverdesc", "Another LoGD Server")) . "");
         }
         if ($location == 0) {
             redirect("news.php");
         } else {
             if ($location == 1) {
                 redirect("inn.php?op=strolldown");
             } else {
                 saveuser();
                 header("Location: {$session['user']['restorepage']}");
                 exit;
             }
         }
     }
 } else {
     $session[message] = "`4Error, your login was incorrect`0";
开发者ID:BackupTheBerlios,项目名称:dragonsaga-svn,代码行数:31,代码来源:login.php


注:本文中的URLEncode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。