This question already has an answer here:
Warning: preg_replace(): No ending delimiter '/' found in C:\wamp\www\upload\upload_demo.php on line 77 I used preg_replace() to replace slash to backslash. But it shows the above warning. Here is the code..
function del_file($file) {
$delete = @unlink($file);
clearstatcache();
if (@file_exists($file)) {
$filesys = preg_replace("/", "\\\\", $file);
$delete = @system("del $filesys");
clearstatcache();
if (@file_exists($file)) {
$delete = @chmod($file, 0775);
$delete = @unlink($file);
$delete = @system("del $filesys");
}
}
Use
str_replace
, or add delimiters to pattern if you really needpreg_replace
.OR