我有一个名为downloads/download的文件中的代码。php:
<?php
header(\'Content-type: application/octet-stream\');
header(\'Content-Disposition: attachment; filename="file.pdf"\');
readfile(\'file.pdf\');
?>
它会正确提示下载文件。pdf。我需要跟踪下载,所以我想利用各种WP功能。为了将页面放入WP中,我添加了博客标题。php类似:
<?php
define(\'WP_USE_THEMES\', false);
require(\'../wp-blog-header.php\');
header(\'Content-type: application/octet-stream\');
header(\'Content-Disposition: attachment; filename="file.pdf"\');
readfile(\'file.pdf\');
?>
这将返回404。有人知道为什么将页面放入WP会导致这种情况吗?