现在很多站都用上了https加密链接,但是一些使用PHPcms v9的朋友发现不能加带https的友情链接,添加时会提示不合法,这是由于PHP中判断没有加入https导致的,下面小编分享完美的解决方法,改几个PHP文件就可以了。
1、打开 PHPcmsmoduleslinkindex.PHP 文件,找到
if($_POST['url']== || !preg_match('/^http://(.*)/i',$_POST['url'])){
showmessage(L('siteurl_not_empty'),?m=link&c=index&a=register&siteid=$siteid);
}
修改为:
if($_POST['url']== || !preg_match('/^(http://|https://)(.*)/i',?m=link&c=index&a=register&siteid=$siteid);
}
找到
$logo = safe_replace(strip_tags($_POST['logo']));
if(!preg_match('/^http://(.*)/i',$logo)){
$logo = '';
}
修改为:
$logo = safe_replace(strip_tags($_POST['logo']));
if(!preg_match('/^(http://|https://)(.*)/i',$logo)){
$logo = '';
}
2、打开 PHPcmsmoduleslinktemplateslink_add.tpl.PHP 文件,找到
$(#link_url).formValidator({onshow:,onfocus:}).inputValidator({min:1,onerror:}).regexValidator({regexp:^http://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&]*([^<>])*$,onerror:})
修改为:
$(#link_url).formValidator({onshow:,onerror:}).regexValidator({regexp:^(http://|https://)[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&]*([^<>])*$,onerror:})
3、打开 PHPcmsmoduleslinktemplateslink_edit.tpl.PHP 文件,和上面link_add.tpl.PHP的方法一样修改就可以了。
之后大家可以在后台更新一下缓存就可以添加https的网站友情链接了
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。