输入banner图图片脚本导航/分类

PHP为表单获取的URL地址预设http字符串函数代码_PHP教程

代码如下:

if (!preg_match("/^(http|ftp):/", $_POST['url'])) {
$_POST['url'] = 'http://'.$_POST['url'];
}

该代码先用正则表达式检查字符串中是否有"http”或"ftp"和冒号":",如果没有,在字符串前添加"http://"

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/321864.htmlTechArticle 代码如下:

if (!preg_match("/^(http|ftp):/", $_POST['url'])) { $_POST['url'] = 'http://'.$_POST['url']; } 该代码先用正则表达式检查字符串中是否有"...