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

WBOY
Release: 2016-06-13 13:23:37
Original
821 people have browsed it

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

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->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('<script>alert("请选择号牌种类!");history.back();</script>');
}
$hpzl = trim($_GET['hpzl']);

if (!$_GET['hphm']) {
    exit('<script>alert("请填写正确的车牌号码!");history.back();</script>');
}
$hphm = strtoupper(trim($_GET['hphm']));

if (!$_GET['tj'] || !in_array($_GET['tj'],array('SYR','SFZMHM','FDJH','CLSBDH'))) {
    exit('<script>alert("所有人不正确!");history.back();</script>');
}
$tj = trim($_GET['tj']);

if (!$_GET['tj_val']) {
    exit('<script>alert("所有人不正确!");history.back();</script>');
}
$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('<script>alert("没有查到该车辆信息,请检查是否输入正确!");history.back();</script>');
}

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

if(!$car){
    exit('<script>alert("没有查到该车辆信息,请检查是否输入正确!");history.back();</script>');
}

$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('<tr style="cursor:hand">
<td align="center" height="22">','',$wg[0]);
        $arr['hpzl'] = str_replace('</td>
<td align="center">','',$wg[1]);
        $arr['wfsj'] = str_replace('</td>
<td align="center">','',$wg[2]);
        $arr['wfdd'] = str_replace('</td>
<td align="center">','',$wg[3]);
        $arr['wfxw'] = str_replace('</td>
<td align="center">','',$wg[4]);
        $arr['fxjg'] = str_replace('</td>
<td align="center">','',$wg[5]);
        $arr['xxly'] = str_replace('</td>
<td align="center">','',$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();
<br>为什么我在html模板使用<?php echo $wg['hphm'];?>显示不出来呢?请各位大侠不吝赐教。 <div class="clear">
                 
              
              
        
            </div>
</td>
</tr>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template