当前位置:Gxlcms > PHP教程 > 施用html模板获取不到php的变量值

施用html模板获取不到php的变量值

时间:2021-07-01 10:21:17 帮助过:22人阅读

使用html模板获取不到php的变量值
PHP code
require_once(dirname(__FILE__)."/../include/common.inc.php");
require_once(DEDEINC.'/arc.partview.class.php');

error_reporting(E_ERROR | E_WARNING | E_PARSE);
function get_sub_content($str, $start, $end){
    if($start == '' || $end == ''){
        return;
    }
    $str = explode($start, $str);
    $str = explode($end, $str[1]);
    return $str[0]; 
}
include('Snoopy.class.php');
if (!$_GET['hpzl'] || !in_array($_GET['hpzl'],array('01','02'))) {
    exit('');
}
$hpzl = trim($_GET['hpzl']);

if (!$_GET['hphm']) {
    exit('');
}
$hphm = strtoupper(trim($_GET['hphm']));

if (!$_GET['tj'] || !in_array($_GET['tj'],array('SYR','SFZMHM','FDJH','CLSBDH'))) {
    exit('');
}
$tj = trim($_GET['tj']);

if (!$_GET['tj_val']) {
    exit('');
}
$tj_val = trim($_GET['tj_val']);
$tj_val = iconv('gb2312','utf-8',$tj_val);

$url = 'http://117.36.53.122:9082/wfcx/query.do?actiontype=vioSurveil&hpzl='.$hpzl.'&hphm='.$hphm.'&tj='.$tj.'&tj_val='.urlencode($tj_val);

$snoopy = new Snoopy();
$snoopy->fetch($url); 
$result = $snoopy->results;
$result = str_replace(chr(10),'',$result);
$result = str_replace(chr(13),'',$result);
$result = str_replace(chr(9),'',$result);


$alert = get_sub_content($result,'alert("','");');
if ($alert) {
    exit('');
}

$car = array();
$car['hpzl'] = get_sub_content($result,'号牌种类 ','');
$car['hphm'] = get_sub_content($result,'号牌号码 ','');
$car['zwpp'] = get_sub_content($result,'中文品牌 ','');
$car['clxh'] = get_sub_content($result,'车辆型号 ','');
$car['cllx'] = get_sub_content($result,'车辆类型 ','');
$car['csys'] = get_sub_content($result,'车身颜色 ','');
$car['yxqz'] = get_sub_content($result,'检验有效期止 ','');
$car['bfqz'] = get_sub_content($result,'强制报废期止 ','');
$car['jdczt'] = get_sub_content($result,'机动车状态 ','');
$car['jdsyr'] = get_sub_content($result,'机动车所有人 ','');

if(!$car){
    exit('');
}

$weigui = get_sub_content($result,'信息来源','');
$weigui = explode('',$weigui);
$weigui = array_filter($weigui);
if ($weigui) {
    foreach ($weigui as $wg){
        $wg = explode('',$wg);
        $arr['hphm'] = str_replace('','',$wg[0]);
        $arr['hpzl'] = str_replace('','',$wg[1]);
        $arr['wfsj'] = str_replace('','',$wg[2]);
        $arr['wfdd'] = str_replace('','',$wg[3]);
        $arr['wfxw'] = str_replace('','',$wg[4]);
        $arr['fxjg'] = str_replace('','',$wg[5]);
        $arr['xxly'] = str_replace('','',$wg[6]);
        $car['weigui'][] = $arr;
    }
}else {
    $car['weigui'] = array();
}
//print_r($weigui);
//print_r($car);
$wg = new PartView();
$wg->SetTemplet($cfg_basedir.$cfg_templets_dir."/default/article_weigui.htm");
$wg->Display();

为什么我在html模板使用显示不出来呢?请各位大侠不吝赐教。

人气教程排行