草庐IT

Week_OF_Month

全部标签

php - 获取错误无法加载资源 : the server responded with a status of 413 (Request Entity Too Large) on ajax upload

我在尝试上传大小超过1MB的文件时遇到以下错误加载资源失败:服务器在ajax上传时返回状态413(请求实体太大)实时链接:http://d.5me.net请帮助我如何解决这个问题?编辑PHPINFO:http://5me.net/phpinfo.php提前致谢 最佳答案 如果您使用的是nginx:在您的http、服务器或位置上下文中设置client_max_body_sizeXXm;。 关于php-获取错误无法加载资源:theserverrespondedwithastatusof413

PHP 5.5 : accessing a static class member of a dynamic class stored in an object

我们假设如下:classa{publicstatic$foo='bar';}classb{public$classname='a';}$b=newb();是否可以通过某种方式(大括号等)直接访问$foo而不会生成“意外的::(T_PAAMAYIM_NEKUDOTAYIM)”:$b->classname::$foo//shouldresultin"bar"notinan"unexpected::(T_PAAMAYIM_NEKUDOTAYIM)"我知道并使用以下解决方法:$c=$b->classname;$c::$foo;但我想知道是否存在另一种直接访问$foo的好方法。

php - fatal error : Out of memory (allocated 1979711488) (tried to allocate 131072 bytes) error occur while writing xlsx file using phpexcel

我已经集成了xlsx文件,用于使用phpexcel从数据库写入。我想在xlsx文件中写入3,00,000条记录。但直到通过Fatalerror:Outofmemory(allocated1979711488)(triedtoallocate131072bytes)我的PHP版本5.3.28我还设置了phpini和单元格缓存,请参阅下面的代码ini_set('max_execution_time',-1);ini_set('memory_limit','-1');$cacheMethod=PHPExcel_CachedObjectStorageFactory::cache_in_memo

php - 迁移 CakePHP 2 到 3 : Before/after-attribute of save button (form helper)

将CakePHP2.x迁移到3.x,在提交按钮中CakePHP2.x具有after和before属性,但这不适用于CakePHP3.x。Form->submit(__('Save'),array('div'=>'form-actions','class'=>'btnbtn-largebtn-primarybtn-save','data-loading-text'=>'PleaseWait...','after'=>''.$this->Html->link(__('Cancel'),array('admin'=>true,'action'=>'index'),array('class'=

php - 遍历二维 bool 数组,只留下最大的连续 "2D blob of ones"

好吧,这个问题措辞有点尴尬,但我希望这能解决问题。我有这个示例二维数组。$array=array(array(1,0,0,0,1,0,0,1),array(0,0,1,1,1,1,0,1),array(0,1,1,0,1,0,0,0),array(0,1,1,0,0,0,1,0),array(1,0,0,0,1,1,1,1),array(0,1,1,0,1,0,1,0),array(0,0,0,0,0,0,0,1));当按行迭代(并以\n结束每一行),然后对每一行按列迭代时,它将回显如下内容:(░░=0,↓↓=1)▓▓░░░░░░▓▓░░░░▓▓░░░░▓▓▓▓▓▓▓▓░░▓▓░░▓▓

php - Laravel 和 Eclipse : How to avoid errors in default code of Laravel 5. 5?

我在Laravel中创建了一个新项目,并使用EclipseIDE(适用于PHP)将其打开,但Laravel为路由生成的默认代码出现错误。我怎样才能防止这种情况发生?我只创建了项目并用Eclipse打开了它,但出现了该错误。 最佳答案 在文件顶部导入Route门面,如Request。useIlluminate\Support\Facades\Route;我推荐使用这个包,barrydvh/ide-helper,在你的项目中。它会生成Laravel外观和其他静态方法的映射,而IDE在开箱即用时会遇到问题。您还需要安装EclipsePHP

php - MVC 模型关系 : how to avoid multiple instances of models?

我正在尝试使用ZendFramework创建一个MVC应用程序来管理运动队和运动员。一个团队有一个球员列表,每个球员只属于一个团队。我遇到的问题是实例化多个单独的玩家。在我实例化单个球员的那一刻,即使我之前实例化了属于同一球队的球员,也总是会创建一个新的球队对象。我怎样才能避免代表同一个团队的不必要的多个实例?是否有一些设计模式或技术可以在这里使用? 最佳答案 可能最常用的模式是IdentityMap. 关于php-MVC模型关系:howtoavoidmultipleinstanceso

php - 如何重定向 Apache "Index of ..."页面?

我正在尝试通过Apache的autoindexmodule使用PHP在Apache中实现经过身份验证的文件列表.我想象的方式是让Apache运行一个PHP脚本作为headerfile.我已经设法让Apache为头文件正确运行PHP,它也能很好地检测到登录cookie。但似乎Apache将头文件作为单独的请求运行,这意味着如果我尝试从PHP发送重定向header,它不会运行。我的(简化的)Apache配置:DocumentRoot"/path/to/files_root"Alias/~extra"/path/to/extra-data"Options-Indexes-MultiViews

php - 如何捕获错误 "Maximum number of allowable file uploads has been exceeded"

我似乎无法仅通过使用PHP捕捉到这一点。这就是我所做的:$maxFiles=(int)ini_get('max_file_uploads');if($maxFiles但是count($_FILES['name'])总是等于$maxFiles(如果发生错误)。而且我真的不想把条件改成==……好像不太对。 最佳答案 我不知道用例到底是什么,但从您的问题来看,用户/访问者似乎可以向表单添加文件上传字段。在这种情况下,您可以将$maxFiles的值放入一个javascript变量中,并在达到最大值时简单地不添加新字段。

php - Doctrine DQL 无效参数编号 : number of bound variables does not match number of tokens

我在这个查询中收到错误无效的参数编号:绑定(bind)变量的数量与标记的数量不匹配。我真的没有看到问题,有什么想法吗?publicfunctiongetByPartial($q,Company$company){$query=$this->createQueryBuilder('u')->join('u.company',':company')->where('u.firstNameLIKE:q')->orWhere('u.lastNameLIKE:q')->setParameters(array('company'=>$company,'q'=>'%'.$q.'%'))->getQu