質問編集履歴
4
a
test
CHANGED
File without changes
|
test
CHANGED
@@ -152,7 +152,7 @@
|
|
152
152
|
|
153
153
|
|
154
154
|
|
155
|
-
|
155
|
+
$array = [
|
156
156
|
|
157
157
|
1 => "https://sample.com/image_name/1/sample_+_title__1_.jpg",
|
158
158
|
|
@@ -162,13 +162,11 @@
|
|
162
162
|
|
163
163
|
];
|
164
164
|
|
165
|
-
$pattern = "
|
165
|
+
$pattern = "image_name/1/sample_+_title__1_.jpg";
|
166
166
|
|
167
|
-
//
|
167
|
+
$result = "/".preg_quote($pattern,"/")."/";
|
168
168
|
|
169
|
-
$result = str_replace('+', '+', $pattern);
|
170
|
-
|
171
|
-
$file = preg_grep($result, $
|
169
|
+
$file = preg_grep($result , $array);
|
172
170
|
|
173
171
|
dd($file);
|
174
172
|
|
3
+
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,7 +154,7 @@
|
|
154
154
|
|
155
155
|
$second = [
|
156
156
|
|
157
|
-
1 => "https://sample.com/image_name/1/sample__title__1_.jpg",
|
157
|
+
1 => "https://sample.com/image_name/1/sample_+_title__1_.jpg",
|
158
158
|
|
159
159
|
2 => "https://sample.com/image_name/2/sample_+_title__2_.jpg",
|
160
160
|
|
@@ -162,7 +162,7 @@
|
|
162
162
|
|
163
163
|
];
|
164
164
|
|
165
|
-
$pattern = "{image_name/1/sample__title__1_.jpg}";
|
165
|
+
$pattern = "{image_name/1/sample_+_title__1_.jpg}";
|
166
166
|
|
167
167
|
//部分文字列を検索して置換する
|
168
168
|
|
2
教授
test
CHANGED
File without changes
|
test
CHANGED
@@ -129,3 +129,59 @@
|
|
129
129
|
|
130
130
|
|
131
131
|
### 検索できずで困っております、ご教授お願いします。
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
### 解決ソースコート
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
````
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
$second = [
|
156
|
+
|
157
|
+
1 => "https://sample.com/image_name/1/sample__title__1_.jpg",
|
158
|
+
|
159
|
+
2 => "https://sample.com/image_name/2/sample_+_title__2_.jpg",
|
160
|
+
|
161
|
+
3 => "https://sample.com/image_name/3/sample_+_title__3_.jpg",
|
162
|
+
|
163
|
+
];
|
164
|
+
|
165
|
+
$pattern = "{image_name/1/sample__title__1_.jpg}";
|
166
|
+
|
167
|
+
//部分文字列を検索して置換する
|
168
|
+
|
169
|
+
$result = str_replace('+', '+', $pattern);
|
170
|
+
|
171
|
+
$file = preg_grep($result, $second);
|
172
|
+
|
173
|
+
dd($file);
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
```
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
# 上記で違うところあればご教授ください。
|
1
a
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
PHP
|
1
|
+
PHPでの記号付き配列検索
|
test
CHANGED
File without changes
|