• 在线客服
    • 蝉知客服
已解决 修改admin.php文件,打开后台后页面乱码

现在用的是备份的文件和在新的电脑上安装的chanzhi

修改文件名以后 输入ip/xxx.php后 出现下面的代码,修改的文件名只有英文,没有空格 特殊字符啥的

* @package chanzhiEPS * @version $Id$ * @link http://www.chanzhi.org */ /* Turn off error reporting first. */ /* Start output buffer. */ ob_start(); /* Define the run mode as admin. */ define('RUN_MODE', 'admin'); /* Load the framework.*/ include 'loader.php'; /* Check admin entry. */ checkAdminEntry(); /* Instance the app. */ $app = router::createApp('chanzhi', $systemRoot); $config = $app->config; /* Check the reqeust is getconfig or not. Check installed or not. */ if(isset($_GET['mode']) and $_GET['mode'] == 'getconfig') die($app->exportConfig()); if(!isset($config->installed) or !$config->installed) die(header('location: install.php')); $common = $app->loadCommon(); /* Change the request settings. */ $config->frontRequestType = $config->requestType; $config->requestType = 'GET'; $config->default->module = 'admin'; $config->default->method = 'index'; /* Run it. */ $app->parseRequest(); $common->checkPriv(); $app->loadModule(); /* Flush the buffer. */ echo helper::removeUTF8Bom(ob_get_clean());

设置备注
答案列表
2018/04/23

php没有解析,是官网的一键安装包部署的话,可以看下:

xampp/runner/res/apache/conf/httpd.conf

xampp/apache/conf/httpd.conf

这2个配置文件,参考下admin.php的逻辑,添加一个修改后的:

<VirtualHost *:%APACHE_PORT%>
  ServerAdmin %PRODUCT_ID%@local.net
  DocumentRoot "%APP_LOCATION%%PRODUCT_ID%/www"
  ServerName localhost:%APACHE_PORT%
  <Directory />
    AllowOverride all
    Require all granted

    <Files "index.php">
      SetHandler application/x-httpd-php
    </Files>
    <Files "admin.php">
      SetHandler application/x-httpd-php
    </Files>

    <Files "test.php">
      SetHandler application/x-httpd-php
    </Files>

    <Files "install.php">
      SetHandler application/x-httpd-php
    </Files>
    <Files "upgrade.php">
      SetHandler application/x-httpd-php
    </Files>
    <Files "file.php">
      SetHandler application/x-httpd-php
    </Files>

  </Directory>
  <DirectoryMatch "%APP_LOCATION%%PRODUCT_ID%/www/.+/.*">
    <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
      SetHandler text/plain
    </FilesMatch>
  </DirectoryMatch>
 
  ErrorLog "%APP_LOCATION%apache/logs/error_log"
  CustomLog "%APP_LOCATION%apache/logs/access_log" combind
</VirtualHost>