草庐IT

data-files

全部标签

php - file_get_contents() 作用于 facebook api

file_get_contents()[function.file-get-contents]:SSL:Connectionresetbypeerin上file_get_contents("https://api.facebook.com/method/events.invite?eid=".$eid."&uids=".json_encode($uids)."&access_token=".$facebook->getAccessToken())它邀请他们选择的用户friend参加事件,但是我在这篇文章的顶部遇到了错误。用cURL测试,同样的错误。已测试我回去用cURL测试了一些东西$

php - 使用 vfsStream 测试 move_uploaded_file 和 is_uploaded_file

我尝试使用PHPUnit和vfsStream测试move_uploaded_file和is_uploaded_file。他们总是返回错误。publicfunctiontestShouldUploadAZipFileAndMoveIt(){$_FILES=array('fieldName'=>array('name'=>'file.zip','type'=>'application/zip','tmp_name'=>'vfs://root/file.zip','error'=>0,'size'=>0,));vfsStream::setup();$vfsStreamFile=vfsStre

当 allow_url_fopen 打开时,php file_get_contents 返回 null

我收到警告消息:file_get_contents未能打开流权限被拒绝我已经在php.ini文件中将all_url_open设置为on。我的php文件在我的apache服务器中,它试图从同一台机器上的tomcat服务器访问一个url(返回JSON)。php文件中的代码如下所示:$srcURL='http://samemachine:8080/returnjson/';$results=file_get_contents($srcURL);我也尝试过curl,但它什么也没返回,也没有访问tomcat服务器:functioncurl($url){$ch=curl_init();curl_s

PHP parse_ini_file 相对路径?

我有这个代码:$test=parse_ini_file("../data/test.ini");test.ini位于后一个目录,然后转到数据文件夹。但我遇到的问题是parse_ini_file不喜欢我建立文件的相对链接,任何人都可以帮助我在不建立文件绝对链接的情况下做到这一点吗? 最佳答案 你可以试试这个:$test=parse_ini_file(realpath("../data/test.ini"));参见this链接或者你可以直接使用绝对路径。 关于PHPparse_ini_fil

ssl - file_get_contents() 无法在 youtube 上正常工作

我想从youtube获取数据,我正在使用file_get_contents()方法。有时它工作正常但有时它不工作并显示以下错误file_get_contents()[function.file-get-contents]:SSL:cryptoenablingtimeoutfile_get_contents()[function.file-get-contents]:Failedtoenablecryptofile_get_contents(https://gdata.youtube.com/feeds/api/users/default?access_token=token&v=2&a

php - $_FILES ['file' ] ['tmp_name' ] 什么时候被删除?

上传的文件将在名为$_FILES['file']['tmp_name']的临时文件夹中的某处存储多长时间? 最佳答案 它在documentation中:Thefilewillbedeletedfromthetemporarydirectoryattheendoftherequestifithasnotbeenmovedawayorrenamed. 关于php-$_FILES['file']['tmp_name']什么时候被删除?,我们在StackOverflow上找到一个类似的问题:

php - 禁用 woocommerce_checkout_update_customer_data

如果用户输入不同的地址,我试图阻止woocommerce在结帐时更新用户元数据(保存的账单和送货用户地址)。在class-wc-checkout.php中有一个设置为true的woocommerce_checkout_update_customer_data过滤器,但我需要知道如何覆盖它并将其设置为false。有什么想法吗?非常感谢卢克 最佳答案 add_filter('woocommerce_checkout_update_customer_data','__return_false');成功了!谢谢@helgatheviking

PHP7 + Symfony 3.1.0 + Vagrant : Failed to write session data

虽然路径/mnt/my-proj/app/../var/sessions/dev对于普通用户和我得到的www-data都是可访问的以下消息:Warning:session_write_close():Failedtowritesessiondata(user).Pleaseverifythatthecurrentsettingofsession.save_pathiscorrect(/mnt/op-accounting2/app/../var/sessions/dev)我只在开发中收到上面的消息,但在产品中没有。/mnt/my-proj/app/../var/sessions/dev和

php - CakePHP/phpunit : how to mock a file upload

我正在尝试为端点编写测试,该端点需要带有附加CSV文件的发布请求。我知道像这样模拟发布请求:$this->post('/foo/bar');但我不知道如何添加文件数据。我尝试手动设置$_FILES数组,但没有成功...$_FILES=['csvfile'=>['tmp_name'=>'/home/path/to/tests/Fixture/csv/test.csv','name'=>'test.csv','type'=>'text/csv','size'=>335057,'error'=>0,],];$this->post('/foo/bar');正确的做法是什么?

php - 使用 $_FILES 和 PHP 上传文件

今天我第一次尝试上传文件到我的网站,但是好像不行。我希望有人能帮助我,我希望我的代码是可读的:)问题是当我选择文件并提交表单时,它不被接受,因为$_FILES是NULLif(move_uploaded_file($_FILES['obrazok']['tmp_name'],$uploadfile))更新错误Warning:move_uploaded_file(www_nekonomagic/res/img/anime/uploads/793392545Untitled.jpg):failedtoopenstream:Nosuchfileordirectoryin/home/gj0209