草庐IT

input-type-file

全部标签

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上

javascript - AJAX 文件上传后 $_POST 和 $_FILES 为空

我是web开发的新手,最近遇到的问题是ajax文件上传...现在我有两个HTML输入字段;一个文件输入和一个按钮。单击按钮后,我将调用具有以下代码的函数..varframe=document.getElementById('Frame_');varframeImg=frame.files[0];varform_data=newFormData();form_data.append('frame',frameImg);jQuery.ajax({url:'./handler.php',type:'post',data:form_datacontentType:false,processDa

php - file_put_contents(.../bootstrap/cache/services.json) : failed to open stream: No such file or directory

我在运行任何phpartisan命令时一直收到此错误。[ErrorException]file_put_contents(/Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json):failedtoopenstream:Nosuchfileordirectory我该如何阻止它? 最佳答案 编辑-如果services.json文件不存在,运行phpartisanserve然后停止强制创建文件。请参阅:laravelservices.jsonn

PHP7 : Methods with a scalar type declaration refuse to type juggle NULL values, 即使在弱/强制模式下

截至PHP7.0,标量类型提示int、float、string和bool可以包含在方法签名中。默认情况下,这些类型声明以弱/强制模式(或“typejuggling”模式)运行。根据PHPmanual:PHPwillcoercevaluesofthewrongtypeintotheexpectedscalartypeifpossible.Forexample,afunctionthatisgivenanintegerforaparameterthatexpectsastringwillgetavariableoftypestring.但即使可以将NULL强制转换为整数0,具有int类型提

php - 在从源代码编译的 PHP 7.1 上安装 SPL_Types

我正在尝试在从源代码编译的PHP7.1.8中安装SPL_Types扩展。我尝试使用sudopeclinstallSPL_Types并从源代码编译扩展,但我得到以下输出:https://mega.nz/#!WE5WjajQ!QyVxMYWrsUiDF6Gq09psYBpR5Y336v26PusnlBNd8bg我知道发布链接并不酷,但我无法将空洞输出放在这里。 最佳答案 此扩展现已过时,无法使用PHP7.x构建。此库的最新版本released2012年,仅支持PHP5.4。native标量类型声明支持使此扩展几乎无用(可能除了SplEn

php - "Type error: Too few arguments to function App\Http\Controllers\UserController::attendance(), 0 passed and exactly 1 expected"

我的数据库中有两个表,分别是用户表和出勤表。我现在想做的是根据用户在与他们的个人资料相关联的出勤View中显示数据库中的出勤数据。这是我在userController中的考勤功能。publicfunctionattendance($id){$user=UserProfile::findOrFail($id);$this->authorize('modifyUser',$user);returnview('user.attendance',['user'=>$user]);}这是我到出勤View的路径。Route::get('/attendance/',['as'=>'user.atte

php - Laravel:第 342 行的非法字符串偏移量 'file',文件 Illuminate/Mail/Mailable.php

我正在尝试使用Laravel的attachFromStorageDisk方法将一些文档附加到电子邮件中,我在文档中了解到:Mail-Laravel.publicfunctionbuild(){$email=$this->view('emails.message')->subject($this->emailSubject);foreach($this->attachmentsas$attachment){$email->attachFromStorageDisk('filemanager',$attachment);}return$email;}我遇到的错误是第342行的Illegal

PHP:如何让 <br/> 在 simplexml_load_file() var 中工作

我正在通过simplexml_load_file()在php中加载一个xml。我用那个加载文件:$xml=simplexml_load_file('flash/datas/datas.xml');然后像这样访问我的内容:$descText=$xml->aboutModule->chocolaterie->descdesc中的文本在我的$descText中很好地注册了,但是所有文本消失了......所以我的长文本在一行上,不太好:-/你知道怎么解决吗?$xml有没有特殊的特质?变量?还是别的?预先感谢您的帮助! 最佳答案 让它发挥作用

php - file_get_contents() PHP 的全局错误处理

我在使用file_get_contents时偶尔会遇到错误,它在我的脚本中使用得相当多。我知道我可以使用@file_get_contents单独抑制错误,并且可以使用设置全局错误消息//errorhandlerfunctionfunctioncustomError($errno){echo'OhNo!';}//seterrorhandlerset_error_handler("customError");但是我该如何专门为所有file_get_content的使用设置错误处理程序呢?谢谢 最佳答案 您可以在调用file_get_co

php - move_uploaded_file 和 is_uploaded_file 之间的区别

使用php表单上传文件时是否需要使用php函数is_uploaded_file来判断是否是通过PHP的HTTPPOST上传机制上传的?我已经阅读了所有有关该功能的资料,但我没有看到它的用途?我错了吗?在php文档中它说ReturnsTRUEifthefilenamedbyfilenamewasuploadedviaHTTPPOST.Thisisusefultohelpensurethatamalicioususerhasn'ttriedtotrickthescriptintoworkingonfilesuponwhichitshouldnotbeworking但是,上传文件的主要功能m