我有一个网站,它将在根目录下使用php://输入读取XML帖子,但不会在子目录下。
我可以通过它在子目录中生成的空请求xml文件来判断。
<?php
$post = trim(file_get_contents('php://input'));
$timeStamp = date("Y-m-d") . "T" . date( "H:i:sP" );
$xmlName = "setupRequest" . $timeStamp . ".xml";
$FileHandle = fopen( "xml/" . $xmlName, 'w' ) or die( "can't open file" );
fwrite( $FileHandle, $post );
fclose( $FileHandle );
?>
它已经在两个不同的URL上进行了测试,一个指向根,另一个指向子目录。我们总是从子目录中获取空白的“setupRequest”文件。
此代码可能存在什么问题?
这是.htaccess文件:
# BEGIN WpFastestCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.reallighting.com [NC]
RewriteRule ^(.*)$ http\:\/\/reallighting\.com\/$1 [R=301,L]
# Start WPFC Exclude
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=AndyAdmin|ETCAdmin|RealAdmin
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^reallighting.com
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WhatsApp|Mediatoolkitbot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !(\/){2}$
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Cookie} !wp_woocommerce_session
RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /homepages/37/d276009229/htdocs/WP/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "index\.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN WPSuperCache
# END WPSuperCache
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress