无法重新声明__()(之前在/usr/local/src/master/xxx/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php中声明:952)

hof1towb  于 2023-11-20  发布在  PHP
关注(0)|答案(1)|浏览(133)
  1. PHP版本:
PHP 8.1.23 (cli) (built: Sep 15 2023 21:56:29) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.23, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.23, Copyright (c), by Zend Technologies

字符串

  1. runkit 7版本:4.0.0a6 x1c 0d1x
    1.操作系统版本和编译器版本
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="aaaa:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"


1.问题是:runkit7_function_remove()不工作。nginx错误日志中出现502错误。示例代码:

$user = Auth::user();
        error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
        try {
          // Remove the function of laravel helper *__* function
          if (function_exists('__')) {
                runkit7_function_remove('__');
          }
        }catch(\Exception $e){
           Log::debug($e->message);
        }
        define('WP_USE_THEMES', true);
        require(public_path() . '/wp/wp-blog-header.php');


1.Laravel helper函数和WordPress函数冲突,我想删除Laravel helper函数。
在WordPress中:__函数在public/wp/wp-includes/l10n.php中。[链接]
在laravel中:__函数位于vendor/laravel/framework/src/Illuminate/Foundation/helpers.php [链接]

gab6jxml

gab6jxml1#

我想结束这期。终于,我得到答案了。
我将WP的l10n.php行编辑到public/index.php中laravel的autoload.php调用行之前
例如:在Laravel的public/index.php中,

require __DIR__. '/wp/wp-includes/l10n.php';

require __DIR__.'/../vendor/autoload.php';

字符串

相关问题