使用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>

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor
