dsce23640 2015-11-27 06:00
浏览 16

Middleman没有在本地运行Regex功能

I have this simple php function

<?php
$ELASTIC_SEARCH_SPECIAL_KEYWORDS = "/[\\+\\-\\=\\&\\|\\!\\(\\)\\{\\}\\[\\]\\^\\\"\\~\\*\\<\\>\\?\\:\\\\\\/]/";

function escapeESReservedChars($text) {
  global $ELASTIC_SEARCH_SPECIAL_KEYWORDS;
  $result = preg_replace_callback ($ELASTIC_SEARCH_SPECIAL_KEYWORDS,
    function ($matches) {
      return "\\" . $matches[0];
    }, $text);
  return $result;
}

Here $text is any text message where if there is any special chars,it will replace that with \\

It run only when i make build & upload to server. If i run this file on localhost it neither run not throw any error. There is no problem with this function. I think middleman is doing something behind the screen.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 个人网站被恶意大量访问,怎么办
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)