如何在显示时将字符串中的URL转换为链接并编辑URL? [英] How to convert URLs in string into Links and Edit the URL while displaying?
问题描述
我对PHP没有很好的了解。我需要帮助:
让我们假设一个字符串:
为什么天蓝色? http:www.whyistheskyblue.com/whyisitsoblue/cansomebodymake_it_red"
现在好了这个字符串,我想将链接中提到的URL转换为同时我想要的URL(因为很长)显示为:
为什么天蓝色? http:www.whyistheskyblue.com/whyisitsob ...... "
如何使用PHP实现这一目标。请帮助我使用简短易用的PHP脚本。谢谢...
I don''t have good knowledge in PHP. I need help with:
Let''s suppose a string:
"Why is sky blue? http:www.whyistheskyblue.com/whyisitsoblue/cansomebodymake_it_red"
Ok now for this string, I want to conver the URL mentioned in to link and at a same time I want the URL (since is quite long) be displayed as:
"Why is sky blue? http:www.whyistheskyblue.com/whyisitsob......"
How will that be possible using PHP. Please help me with short and easy PHP script to do so. Thanks...
推荐答案
我无法理解你想做什么。你能详细说明吗?
I could not understand what you wish to do. Can you please elaborate it?
我无法理解你想做什么。你能详细说明吗?
I could not understand what you wish to do. Can you please elaborate it?
[PHP]
[PHP]
string ="世界是光明的。检查以下网址:http://bytes.com/forum/newreply.php?do = newreply& p = 3182222" ;;
[/ PHP]
现在我想转换
string="The world is bright. Check this URL: http://bytes.com/forum/newreply.php?do=newreply&p=3182222";
[/PHP]
Now I want to convert URL in
这篇关于如何在显示时将字符串中的URL转换为链接并编辑URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!