[英]make internal link to be external
So, 所以,
if user enter site with protocol ( https://facebook.com ) there is no problem and it goes to https://facebook.com 如果用户使用协议( https://facebook.com )输入网站,则没有问题,并且转到https://facebook.com
but if user enter something like this facebook.com it will be internal link and goes to https://my.site.com/facebook.com 但是,如果用户输入类似此facebook.com的内容,它将是内部链接,并转到https://my.site.com/facebook.com。
how can i avoid this situation? 我如何避免这种情况?
Check if there is ://
in the entered data. 检查输入的数据中是否有
://
。 If not then add http://
如果没有,请添加
http://
除非您需要进行一些高级检查,否则只需在他们添加网址/网站时对其进行检查-如果“ site”值不是以http://或https://开头,则只需在添加前将其添加它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.