草庐IT

input-type-file

全部标签

php - 在 PHP 中将 id=1&type=2 之类的字符串转换为数组的最快方法?

我需要把它改成:$arr['id']=1;$arr['type']=2; 最佳答案 使用:parse_str().voidparse_str(string$str[,array&$arr])ParsesstrasifitwerethequerystringpassedviaaURLandsetsvariablesinthecurrentscope.例子: 关于php-在PHP中将id=1&type=2之类的字符串转换为数组的最快方法?,我们在StackOverflow上找到一个类似的问题

PHP __FILE__ 继承

我正在尝试编写一种可以在使用文件完整路径的扩展类中使用的方法。但是,当我使用__FILE__时,我只会返回定义继承方法的类的路径。这是一个示例:foo.phpclassfoo{publicfunctiongetFullFile(){return__FILE__;}}酒吧.phpclassbarextendsfoo{publicfunctiongetFile(){return__FILE__;}}例子.php$foo=newfoo();echo$foo->getFullFile().PHP_EOL;$bar=newbar();echo$bar->getFullFile().PHP_EOL

php - SessionHandler::gc():ps_files_cleanup_dir |权限被拒绝 (13)

我在CentoOS(WHM/CPANEL)和Prestashop1.7中遇到PHP7问题系统给我这个消息:Noticeonline429infile/home/onywf3fr9a/public_html/app/cache/dev/classes.php[8]SessionHandler::gc():ps_files_cleanup_dir:opendir(/var/cpanel/php/sessions/ea-php70)失败:权限被拒绝(13) 最佳答案 背景当PHP尝试对过期的session进行垃圾回收,但包含session

Nginx 和 Dropbox 文件夹内的符号链接(symbolic link)根目录导致 "File not found."

原始问题Imetastrangeproblemwithnginx+php-fpm.Ifmyrootdirectorysettosomethinglike~/playground/apps/foo/public/,everythingworksfine.IfIsymlink~/playgroundto~/Dropbox/playgroundNginxrendersa"Filenotfound."string.Ifirstthoughtthatitwasapermissionsproblem,butitisn't(doublecheckedwithasimplephpfile)Somyqu

Input::get() 和 $_GET[] 之间的 PHP 区别

有什么区别Input::get('value')还有这个:$_GET['value']什么时候最好使用其中之一? 最佳答案 第一行代码input::get('value')是一些框架(可能是Laravel4.2)包装PHPGETvariables比如第二行代码$_GET['value']这是一个PHPsuperglobal包含相同的数据,但使用普通的PHP。所以区别或多或少是语法上的,例如你如何前缀,写名字和括号:PrefixNameParenthesis-none-"input::get"()"$""_GET"[]除了语法差异之外

php - 函数 file_get_contents() 是否有替代方案?

在我的虚拟主机服务器中,file_get_contents()功能被禁用。我正在寻找替代方案。请帮忙 最佳答案 file_get_contents()几乎做了以下事情:$filename="/usr/local/something.txt";$handle=fopen($filename,"r");$contents=fread($handle,filesize($filename));fclose($handle);由于file_get_contents()被禁用,我非常确信上述方法也不会起作用。根据您尝试阅读的内容,根据我的经验

PHP DOM 文档 : How do I get the value of an input field

如何使用PHP的DOMDocument获取没有ID属性的输入字段的值? 最佳答案 XPath让它变得简单,假设这是唯一以“make”作为名称的文本输入:$dom=newDOMDocument();$dom->loadHTML(...);$xp=newDOMXpath($dom);$nodes=$xp->query('//input[@name="make"]');$node=$nodes->item(0);$car_make=$node->getAttribute('value');如果页面上有多个具有该特定字段名称的输入(这完全有

php - 为什么我的 PHP 数组给我 "Cannot use object of type stdClass as array"?

任何人都可以在这里提供帮助,我正在使用一个数组来拆分一些数据,并且在附加到的View上我收到了上面的错误。这是我的代码:用于ajaxView的PHP:$images=array();$data_link=array();$data_id=array();$data_likes=array();$data_text=array();foreach($mediaas$data){//dd($data->caption);$images[]=array(//dd($data->caption),"data_url"=>$data->images->standard_resolution->u

php - laravel 中的 isset(Input::old ('abc')

我在something.blade.php中使用的代码是{{Form::text('fullname',isset(Input::old('fullname'))?Input::old('fullname'):$hello[1]}}但我不确定为什么会返回以下错误Can'tusefunctionreturnvalueinwritecontext一直在尝试isset、trim、empty但没有任何效果。有什么问题? 最佳答案 你可以简单地使用这个{{Form::text('fullname',Input::old('fullname',

php - 为什么当我手动为 $_POST 数组赋值时 filter_input() 返回 NULL?

我正在做一些关于数据验证的练习,并决定弄乱filter_input()函数。当我尝试运行这段代码时:$_POST['var']=10;$filtered=filter_input(INPUT_POST,'var',FILTER_VALIDATE_FLOAT);var_dump($filtered);var_dump($filtered)返回NULL。我知道如果通过提交表单为$_POST['var']分配了一个值,代码就可以工作,但我只是想知道为什么手动为$_POST[]数组不返回float(10)? 最佳答案 filter_inpu