草庐IT

result_dir

全部标签

php - __DIR__ VS 使用反射

在Symfony2中,我看到如下代码:if(null===$this->rootDir){$r=new\ReflectionObject($this);$this->rootDir=dirname($r->getFileName());}为什么不直接使用__DIR__?if(null===$this->rootDir){$this->rootDir=__DIR__;}它们有什么区别? 最佳答案 __DIR__返回调用它的文件的目录。Symphony2代码返回定义类的目录,这很可能是一个不同的文件。

php - 消息 : cache_dir must be a directory

大家好,我在使用ZendFramework时遇到了一些问题。我首先收到以下消息:消息:无法确定临时目录,请手动指定cache_dir。我用谷歌搜索并找到这篇文章:ZendFramework:Couldnotdeterminetempdirectory,pleasespecifyacache_dirmanually我读了它,现在当我填写表格时出现以下错误:(我把..放在错误中的任何地方都表示域。)消息:cache_dir必须是一个目录-#0/home/daan/domains/../library/Zend/Cache/Backend/File.php(154):Zend_Cache::

php - var_dump($_FILES) result in blank ["type"] 对于特定的图像文件

我有一张用旧数码相机拍摄的图像,大小约为4MB,类型为“image/jpeg”。当我通过表单提交并查看var_dump($_FILES);时,数组如下:array(1){["userfile"]=>array(5){["name"]=>string(12)"IMGP0004.JPG"["type"]=>string(0)""["tmp_name"]=>string(0)""["error"]=>int(1)["size"]=>int(0)}}我想知道它是否没有选择文件类型并将文件大小检测为0是否有原因。其他文件回显所有正确信息。 最佳答案

php - 无法在 IIS 上设置 upload_tmp_dir

所以我尝试在IIS机器上设置phpupload_tmp_dir设置。我更改了php.ini中的设置,但phpinfo()仍然显示默认文件夹。我查看了IIS_IUSRS的权限,有write,read,modify等我还运行了这个来检查新文件夹是否可写:$filename='C:\inetpub\temp\uploads';if(is_writable($filename)){echo$filename.'iswritable';}else{echo$filename.'isnotwritable';}我更改了max_file_uploads值以测试正在加载的PHP配置是否是最新的,事实确

php - getcwd 和 __DIR__ 有什么区别?

DIR是一个魔法常量,如PHPdocs中所述.getcwd()只是根据PHPdocs的当前工作目录.我的用例是://thisismyindex.phpfilerequire_once__DIR__.'/vendor/autoload.php';$app=newSilex\Application();$app['debug']=true;$app->get('/{name}',function($name)use($app){return$app->sendFile(__DIR__.'/web/source/index.php');});我不完全理解为什么我需要这些机制中的任何一种,因为

php - Zend Framework : Could not determine temp directory, 请手动指定一个 cache_dir

我正在学习Zend框架。我创建了一个简单的Zend_Form,当我提交表单时出现以下错误:AnerroroccurredApplicationerrorExceptioninformation:Message:Couldnotdeterminetempdirectory,pleasespecifyacache_dirmanuallyStacktrace:-0H:\Documents\IIS_Server_Root\zendframework\Zend\Cache\Backend.php(197):Zend_Cache::throwException('Couldnotdeter...'

PHP : imploding array and storing the result back to same variable

下面的代码有没有坑。这样使用安全吗?我不会再使用该阵列$records_msg=implode("",$records_msg); 最佳答案 不是真的,但是为数组使用不同的变量名可能会提高可读性,因为它还不是消息。 关于PHP:implodingarrayandstoringtheresultbacktosamevariable,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/33

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

PHP "list"问题 : Why the result is in reverse order?

您能否详细解释为什么出现此代码:$arr=array(1,2,3);list($result[],$result[],$result[])=$arr;print_r($result);结果:Array([0]=>3[1]=>2[2]=>1)? 最佳答案 请参阅list的PHP文档:list()assignsthevaluesstartingwiththeright-mostparameter.Ifyouareusingplainvariables,youdon'thavetoworryaboutthis.Butifyouareusi

php - fatal error : Call to a member function get_results() on a non-object (jQuery From Plugin & WordPress)

我正在尝试在Wordpress插件中使用jQuery的表单插件。我正在关注这个example.我已经将我的脚本排入队列并构建了我的表单。在csf_form_handler.php中,相当于示例的json-echo.php,我可以访问在我的表单中选择的项目(我有一个单选按钮组)。我的目标是在SELECT语句中使用在表单中选择的值从自定义wordpress数据库表返回数据。$csf_selected_sport=$_POST['csf_radiobutton_group_sport'];global$wpdb;$csf_db_table=$wpdb->prefix."activity";$