urlencode( $txt )本函数将txt字符串以 URL 编码。例如空格就会变成加号。Homepage 中 form 资料传送就是用 urlencode 编码后再送出。if( $encode ) { echo urlencode( $txt ); }
else          { echo $txt; }
如果变量encode存在,则将变量txt以URL编码,并输出编码后的字串,否则直接输出txt变量串下面是帮助文件上的例子,你看看就更明白了:本例将中文字符串以 URL 编码过,转给别的 PHP 使用
<?php
$EncodeStr=urlencode($ChineseName);
echo "<a href=/php/personal.php?n=$EncodeStr>个人信息</a>";
?>