php文件运行结果是纯文本,如何将上传的php文件显示为纯文本而不是在wordpress中执行?...

编辑/ tmp中的testme.php文件.

echo "test";

?>

编辑一篇名为test and upload file /tmp/testme.php的新帖子,用url http://home.local/wp/?p = 4785发布.

384a60801453693686f64d6cb02cd144.png

我想看看testme中的内容,点击它,在wordpress中弹出新窗口.

b3cde7bb0e507fb1ef69ca7c7b540658.png

继续点击它.网页上显示的测试结果.

我的期望:

1.只需在测试帖中点击testme一次.

2.将testme.php显示为纯文本,

echo "test";

?>

而不是执行testme.php的结果.

test

我根据一些材料显示配置php文件作为apache中的纯文本.

sudo vim /etc/apache2/sites-available/000-default.conf

ServerName www.home.local

ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

Options Indexes FollowSymLinks MultiViews

AllowOverride All

allow from all

php_flag engine off

AddType text/plain php

重启apache2(在debian中构建).

sudo systemctl restart apache2

要打开帖子http://home.local/wp/?p = 4785,我在网页上得到以下输出:

/**

* Front to the WordPress application. This file doesn't do anything, but loads

* wp-blog-header.php which does and tells WordPress to load the theme.

*

* @package WordPress

*/

/**

* Tells WordPress to load the WordPress theme and output it.

*

* @var bool

*/

define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值