Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem that the diagonal bar can not be recognized in php

Shulou Source: shulou.com Published: 2022-06-01 21:30:14 10月04日 Update

Today, the editor will share with you the relevant knowledge points about how to solve the problem that can not be identified by the diagonal bar in php. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

The solution that the slash bar can not be recognized in php: 1, open the corresponding code file; 2, replace the backslash in the path with the forward slash to identify normally.

This article operating environment: Windows7 system, thinkphp5.0 version, DELL G3 computer

The diagonal bar in php is not recognized?

Is the path in the data table queried by thinkphp5.0 caused by a backslash to prevent the picture from being displayed properly?

The path added to the image in the data table is sometimes a backslash, which makes it unrecognizable when writing the path after url (but it can be identified by writing the path after src), so you need to replace the backslash in the path with a forward slash, as shown below:

$datu = Db::query ('select images from think_ad where ad_position_id = 22'); $str= ""; foreach ($datu as $v) {$str. = implode ($v); $str. = "|";} $str= substr ($str,0,strlen ($str)-1); $str=str_replace ('\','/', $str); $str= explode ("|", $str); $this- > assign ('datu',$str) These are all the contents of this article entitled "how to solve the problem that the diagonal bar cannot be recognized in php". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Slashes paths slashes knowledge articles code content pictures data datasheets different big methods most that is files time more environment computer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Docker Microsoft Redmi MariaDB