草庐IT

content-security-policy

全部标签

php - 在PHP的curl中指定multipart/form-data各部分的Content-Type

如何指定多部分/表单数据请求的特定部分的内容类型?图像的内容类型作为application/octet-stream发送,但服务器期望它是image/jpeg。这会导致服务器拒绝我的请求。$data["file"]="@/image.jpg";$data["title"]="Thetitle";$data["description"]="Thedescription";//makethePOSTrequest$curl=curl_init();curl_setopt($curl,CURLOPT_URL,$url);curl_setopt($curl,CURLOPT_VERBOSE,1)

php - 在共享主机环境中关闭页面的 mod_security

当我通过其他页面发布方法发布一些html和javascript混合数据时,我的页面显示错误禁止访问错误。但是当我直接打开该页面时,它正确显示,没有任何错误。我在发布数据时知道这是与服务器安全相关的问题。当我搜索时,我在.htaccess文件中找到了Turnoffmod_security的解决方案。但我只想为这个页面而不是我的整个网站这样做。我的托管环境是共享的。但我可以编辑我的.htaccess文件。 最佳答案 看看一些mod_securityand.htaccesstricks.有很多不同的方法可以启用或禁用mod_sceurit

php - file_get_contents() 无法打开流 : No such file or directory

我正在编写一些php脚本来更新我网站上的代码。为了做到这一点,我编写了以下行来检查更新版本,并从我用来分发更新的地方获取名称,然后创建该名称的链接。我做过这样的事情。$filename="http://www.hf-live.com/codeupdate/Get_Files_Name.php";$contents=file_get_contents($filename);echo$contents;我收到这个错误failedtoopenstream:Nosuchfileordirectory.即使文件存在,我仍然遇到同样的错误。我已将allow_url_fopen开启为on。上面的代码

php - file_put_contents 无法在包含路径中创建文件

我正在尝试在桌面上创建一个文本文件。我使用set_include_path()创建了一个包含路径,但该文件是在我的xampp/htdocs文件夹中创建的。我如何在我的桌面上创建该文件夹??这可能吗??set_include_path(',;c:/users/shimantta/Desktop');echofile_put_contents("/test.txt","HelloWorld.Testing!",FILE_USE_INCLUDE_PATH); 最佳答案 包含路径是PHP在包含/需要文件时搜索的路径,而不是在写入文件时搜索的

php - 防火墙 "secured_area"的 Symfony InvalidConfigurationException

我是Symfony的新手,我正在尝试Symfony中显示的不同示例.但是,我的security.yml文件出现以下错误InvalidConfigurationExceptioninSecurityExtension.phpline430:Noauthenticationlistenerregisteredforfirewall"secured_area".我的security.yml文件是这样的security:providers:in_memory:memory:users:foo:password:$2a$12$2nJYjp5DxX0o.ZgGL8ybEOG/MepViC08G1H

php - 打开 session.cookie_secure 会注销我的用户吗?

我正在运行一个https站点并想在php.ini中打开这些以提高安全性:session.cookie_httponly=1session.cookie_secure=1我可以在网上找到很多关于此的信息,但没有关于打开它时旧sessionID的持久性的信息。打开此选项是否会导致自动注销用户,因为php现在需要安全cookie,但登录用户没有那些……就在切换之后? 最佳答案 有趣的是,在我的职业生涯中,我已经为数百个使用HTTPS的网站启用了此功能,但从未让所有人退出。这些.ini设置通常应用于新的sessioncookie,secur

php - 验证码 file_get_contents() : SSL operation failed

我正在为我的网页使用GooglereCaptcha。在测试模式下一切正常。无SSL。当我在生产环境中测试我的网页时,出现以下错误:Warning:file_get_contents():SSLoperationfailedwithcode1.OpenSSLErrormessages:error:14090086:SSLroutines:SSL3_GET_SERVER_CERTIFICATE:certificateverifyfailedin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.phponline68Warni

php - 从 file_get_contents() 值创建数组

socallink.txt:"Facebook","Twitter","Twitter","google-plus","youtube","pinterest","instagram"PHP:$file=file_get_contents('./Temp/socallink.txt',true);$a1=array($file);print_r($a1);结果:Array([0]=>"Facebook","Twitter","Twitter","google-plus","youtube","pinterest","instagram")需要:$a1['0']=facebook;$a1

php - File_get_contents, curl 不起作用

发生了一些奇怪的事情,我想知道为什么。在这个网址上:http://api.promasters.net.br/cotacao/v1/valores?moedas=USD&alt=json,它在浏览器中运行良好,但是当我尝试使用php检索内容时:echofile_get_contents('http://api.promasters.net.br/cotacao/v1/valores?moedas=USD&alt=json');没有打印任何东西,var_dump(...)=string(0)"",所以我更进一步并使用了:functionget_page($url){$curl=curl_

PHP - zip 文件中子目录内文件的 file_get_contents()

我有一个.zip文件,里面有多个子目录和文件。如何使用file_get_contents()获取zip文件的子目录之一中的文件内容? 最佳答案 如果您安装了Zip扩展,它应该已经注册了zip://compressionwrapper.尝试以下操作:$result=file_get_contents('zip://path_to_my.zip#subDir/foo.txt'); 关于PHP-zip文件中子目录内文件的file_get_contents(),我们在StackOverflow上