SpriteWood everybody is one single tree « mpd - Music Player Daemon install VMware Server »

Check Url

 
<?php
$old_url = $_SERVER["REQUEST_URI"];
 
//检查链接中是否存在 ?
$check = strpos($old_url, '?');
 
//如果存在 ?
if($check !== false){
 
//如果 ? 后面没有参数,如 http://www.yitu.org/index.php?
if(substr($old_url, $check+1) == ''){
 
//可以直接加上附加参数
$new_url = $old_url;
 
}
 
else //如果有参数,如:http://www.yitu.org/index.php?ID=12
{
$new_url = $old_url.'&';
}
 
}else //如果不存在 ?
{
$new_url = $old_url.'?';
}
 
echo $new_url;
?>

详情见http://www.codebit.cn/pub/html/php_mysql/tip/other/check_url_parameter/

Tags: ,

Wednesday, June 11th, 2008 at 8:39 pmand is filed under php. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

>
  • Categories

  • Recent Posts

  • Recent Comments

  • SpriteWood is proudly powered by WordPress
    Entries (RSS) and Comments (RSS).