Home > Backend Development > PHP Tutorial > 怎么不让smarty对url中的“&”转成“&”

怎么不让smarty对url中的“&”转成“&”

WBOY
Release: 2016-06-13 12:24:14
Original
1397 people have browsed it

如何不让smarty对url中的“&”转成“&”?
后台:

<br />function save_sort_handler(){<br />	//-----获取应该返回的地址-----//<br />	$backUrl=R('backUrl','');<br />	if(empty($backUrl) && isset($_SERVER["HTTP_REFERER"])){<br />		$backUrl=$_SERVER["HTTP_REFERER"];<br />	}<br />	$GLOBALS['smarty']->assign("backUrl",$backUrl);<br />	//----------------------//<br />	$GLOBALS['smarty']->display("takeaway_sort.dwt");<br />}<br />
Copy after login


前台:
<br /><script type="text/javascript"><br />			alert('{$backUrl}');<br />			var isComplete={$isComplete};<br />			<br />			if(isComplete){<br />				var result="保存成功!";<br />			}<br />			else{<br />				var result="保存失败!";<br />			}<br />			if(confirm(result+" 是否返回?")){<br />				location.href='{$backUrl}';<br />			}<br />			else{<br />				var type='{$type}';<br />				if(type!=''){<br />					location.href="takeaway_sort.php?type={$type}&backUrl={$backUrl}";<br />				}<br />			}<br />		</script><br />
Copy after login


后台的echo和前台的alert出的$backUrl分别为:

------解决思路----------------------
转义一下不行吗?
------解决思路----------------------
你的来源url地址是什么样子?是否也是被处理过的。
------解决思路----------------------
你在 $GLOBALS['smarty']->assign("backUrl",$backUrl); 之前看一下 $backUrl
echo $backUrl;
应该是已经变了,与 smarty 无关
------解决思路----------------------
alert({$backurl
------解决思路----------------------
smarty:nodefaults}) 试试

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