thinkphp5.0 the path in the queried data table is the backslash that causes the picture to not display properly?

Source: Internet
Author: User

The path that is added to the picture in the datasheet can sometimes be a backslash, which causes the path to be recognized after the URL is written (although the path is recognized after the SRC), so you need to replace the backslash in the path with a forward slash, and the code is as follows:

1 $datu= Db::query (' Select images from think_ad where ad_position_id = 22 ');2     $str= "";3     foreach($datu  as $v)4     {5         $str.=implode($v);6         $str.= "|";7             8     }9     $str=substr($str, 0,strlen($str)-1);Ten     $str=Str_replace(‘\\‘,‘/‘,$str); One     $str=Explode("|",$str); A     $this->assign (' Datu ',$str);

thinkphp5.0 the path in the queried data table is the backslash that causes the picture to not display properly?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.