图案和更换有问题。如何使替换回声成为最终产品,例如
INSERT INTO `table` (`person`, `file`) VALUES
('test','test'),
('test2','test2'),
('test3','test3');
我正在尝试将字符串插入 SQL,但我需要格式化下面的当前字符串,并且我需要字符串的最后一部分test3:test3或任何文本可能是关闭 SQL 模式('test3 ','test3');
<?php
$string = 'test:test test2:test2 test3:test3';
$pattern = '';
$replacement = '';
echo preg_replace($pattern, $replacement, $string);
?>
另外,它也可以有这样的字符串吗?'test@test.com:test test2:test2'
而电子邮件将始终位于冒号之前。