php里我怎么用GET方法向另一个页面传递一段html代码(超级链接的)
1个回答
2014-01-21
展开全部
读过rfc2616就知道这种情况下最好的办法就是对字段进行base64编码.
<?php
header("Content-Type: text/html;charset=gb2312");
if(isset($_GET['url'])){
$str = $_GET['url'];
echo '<li>raw : ' , $str;
$str = base64_decode($str);
echo '<li>decode : ' , $str;
}
$rawurl = ' http://zhidao.baidu.com/question/119616843.html?fr=uc_push&中文==很长的一段中文';
$encodedurl = base64_encode($rawurl);
?>
<li><a href='<?php echo $_SERVER['SCRIPT_NAME'] , '?url=' , $encodedurl; ?>'>href - encoded </a>
<li><a href='<?php echo $_SERVER['SCRIPT_NAME'] , '?url=' , $rawurl; ?>'>href - encoded </a>
<li><a href='<?php echo $_SERVER['SCRIPT_NAME'] ;?>'>href - encoded </a>
<?php
header("Content-Type: text/html;charset=gb2312");
if(isset($_GET['url'])){
$str = $_GET['url'];
echo '<li>raw : ' , $str;
$str = base64_decode($str);
echo '<li>decode : ' , $str;
}
$rawurl = ' http://zhidao.baidu.com/question/119616843.html?fr=uc_push&中文==很长的一段中文';
$encodedurl = base64_encode($rawurl);
?>
<li><a href='<?php echo $_SERVER['SCRIPT_NAME'] , '?url=' , $encodedurl; ?>'>href - encoded </a>
<li><a href='<?php echo $_SERVER['SCRIPT_NAME'] , '?url=' , $rawurl; ?>'>href - encoded </a>
<li><a href='<?php echo $_SERVER['SCRIPT_NAME'] ;?>'>href - encoded </a>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询