gpt4 book ai didi

php - http ://wrapper is disabled in the server?

转载 作者:行者123 更新时间:2023-12-03 20:27:34 25 4
gpt4 key购买 nike

错误信息:

Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\xampp\htdocs\ubergallery\multiple_image_upload\multiupload.php on line 27

Warning: include(http://localhost/ubergallery/multiple_image_upload/upload.php): failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\ubergallery\multiple_image_upload\multiupload.php on line 27

Warning: include(): Failed opening 'http://localhost/ubergallery/multiple_image_upload/upload.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\ubergallery\multiple_image_upload\multiupload.php on line 27

我收到此错误消息。

包含具有绝对路径的样式表或 jquery 文件确实可行,因此我希望包含具有绝对路径的 PHP 脚本。

这是代码:
<!DOCTYPE html>
<html>
<head>
<title>Upload Multiple Images Using jquery and PHP</title>
<!-------Including jQuery from google------>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="script.js"></script>

<!-------Including CSS File------>
<link rel="stylesheet" type="text/css" href="style.css">
<body>
<div id="maindiv">

<div id="formdiv">
<h2>Multiple Image Upload Form</h2>
<form enctype="multipart/form-data" action="" method="post">
First Field is Compulsory. Only JPEG,PNG,JPG Type Image Uploaded. Image Size Should Be Less Than 100KB.
<hr/>
<div id="filediv"><input name="file[]" type="file" id="file"/></div><br/>

<input type="button" id="add_more" class="upload" value="Add More Files"/>
<input type="submit" value="Upload File" name="submit" id="upload" class="upload"/>
</form>
<br/>
<br/>
<!-------Including PHP Script here------>
<?php include("http://localhost/ubergallery/multiple_image_upload/upload.php"); ?>
</div>

<!-- Right side div -->
<div id="formget"><a href=http://www.formget.com/app><img src="formget.jpg" alt="Online Form Builder"/></a>
</div>
</div>
</body>
</html>

我希望在绝对路径中包含“upload.php”。

当我将“allow_url_include”设置为“On”时,我仍然收到相同的错误消息。我也不确定这是否是开始的问题。

有什么建议在这里做什么吗?

最佳答案

来自 PHP docs on include :

If "URL include wrappers" are enabled in PHP, you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Supported Protocols and Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.



通过明显的推断,您应该使用本地路径名!

改变这一行
<?php include("http://localhost/ubergallery/multiple_image_upload/upload.php"); ?>

对此
<?php include($_SERVER['DOCUMENT_ROOT']."/ubergallery/multiple_image_upload/upload.php"); ?>

原因 allow_url_include=On不起作用是因为您可能在更改 php.ini 后没有重新启动 Apache 服务器。

关于php - http ://wrapper is disabled in the server?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26281426/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com