drus39136 2017-12-10 15:55
浏览 85
已采纳

如何从已编辑的变量加载图像?

Hello and sorry for the noobie question
Let's say i have a variable with value url

<input type="text" name="link">

Which submits the following link :

domain.com/profile/deCKfkiriCJFff 

Since the link above is not a valid img src i would like to display an image with the same source but with one slight change :

domain.com/profile/images/deCKfkiriCJFff 

^ valid image link

  • 写回答

1条回答 默认 最新

  • dsv73806 2017-12-10 16:17
    关注

    Use explode

    $domain = 'domain.com/profile/deCKfkiriCJFff';
    $exploded = explode('profile', $domain);
    $validUrl =  $exploded[0].'profile/images'.$exploded[1];
    echo $validUrl; 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改
  • ¥15 Windows 系统cmd后提示“加载用户设置时遇到错误”
  • ¥50 vue router 动态路由问题
  • ¥15 关于#.net#的问题:End Function
  • ¥15 无法import pycausal
  • ¥15 VS2022创建MVC framework提示:预安装的程序包具有对缺少的注册表值的引用
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义
  • ¥15 嵌入式--定时器使用
  • ¥20 51单片机学习中的问题