In actual development, you always encounter this situation.
Www.2cto.com or when there is too much data in this case, it will make you crazy. If you still use select fields from table where like '/%', it is definitely a thankless approach, then, taking a closer look at the built-in functions of MYSQL is definitely the first priority. I first thought that the trim in the PHP function may also be used in mysql. The answer is yes. You can find it in the MYSQL manual. Of course, you can refer to Baidu. What I am talking about below is the same as that of my predecessors. Www.2cto.com [SQL]
SELECT *, trim (LEADING '/' FROM 'path') as paths FROM 'ts _ back_pic 'limit 10 grand introduction to the first, LEADING, you can delete the specified character on the left and the string [SQL] SELECT *, trim (TRAILING '/' FROM 'path') as paths FROM 'ts _ back_pic 'limit 10 second, you can delete specified characters and strings on the right.
Www.2cto.com
[SQL] SELECT *, trim (BOTH '/' FROM 'path') as paths FROM 'ts _ back_pic 'limit 10 third, you can delete specified characters and strings on BOTH sides
Most importantly, trim deletes multiple characters in a PHP function, in MYSQL, the deletion is a simple [SQL] SELECT *, trim ('path') as paths FROM 'ts _ back_pic 'limit 10; delete spaces on BOTH sides to form a comprehensive sequence of [SQL] SELECT *, trim (BOTH '\ r \ n' FROM trim ('path ')) as paths FROM 'ts _ back_pic 'limit 10; Environment: enter a space and then press enter to delete the space + press ENTER