• Welcome to Journal web site.

我是 PHP 程序员

- 开发无止境 -

Next
Prev

在 MySQL 5.7 中搜索反斜杠(\),对于 Like 时的转义,需要使用 \\\\

Data: 2015-06-25 11:11:24Form: JournalClick: 22

1、表中数据如下

1
INSERT INTO `object_store`.`theme_asset`(`id`, `theme_id`, `version`, `asset_key`, `mime_type`, `category`, `schema`, `created_at`, `updated_at`) VALUES (63, 'vogue', '', 'layouts\\basic.blade.php', 'text/html', 'unknown', NULL, '2022-02-15 09:59:41', '2022-02-15 09:59:41');

2、当在执行 where like 查询时,使用 like ‘layouts\\%’ 试图查询出以 layouts\ 开头的数据行。结果为空。如图1

image.png

图1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
select
  `id`,
  `theme_id`,
  `version`,
Name:
<提交>