简体   繁体   English

PHP:如何替换特定单词后的文本?

[英]PHP: How to replace text after a specific word?

I have a string that will be executed as a query but it have between functions in this way:我有一个将作为查询执行的字符串,但它以这种方式between函数between具有:

BETWEEN '2019-01-01 AND 2019-01-31'

But I need to replace it with this so PostgreSQL can understand it:但是我需要用这个替换它,以便 PostgreSQL 可以理解它:

BETWEEN '2019-01-01' AND '2019-01-31'

我解决了:

$string = str_replace(" AND ", "' AND '", $string);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM