草庐IT

non-existing

全部标签

PHP 'non-object' 错误

这个问题在这里已经有了答案:Calltoamemberfunctiononanon-object[duplicate](8个答案)关闭9年前。我正在使用PHP编写一个小型MVC框架来进行练习。然而,PHP似乎不喜欢我的Controller类。该类包含加载View的加载器实例:abstractclassController{public$load;function__construct($load){$this->load=$load;}abstractpublicfunctionindex();}从那里,我可以覆盖我所有Controller的Controller。例如,我的索引Cont

php - apc_exist() 不存在?

我很难让PHPAPC工作。这是我的测试代码:CACHEINFO(USER):CACHEINFO:FOO:BAR:barexists!bardoesnotexist!简而言之:您填写表格,插入的值存储在APC中。始终存储key“foo”。您可以尝试存储“bar”以查看apc_fetch()使用新添加的key。什么工作正常:apc_store()apc_fetch()什么不是:apc_cache_info()(无论我将哪些参数传递给函数)总是打印一个空数组,尽管apc_fetch()成功检索数据apc_clear_cache()从不清除缓存(“bar”总是在输入后显示)。如果我提供一个"u

php - ( fatal error : Call to a member function bind_param() on a non-object)

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭4个月前。我收到此文本的错误:(抱歉我的英语不好,我来自德国!)错误:fatalerror:在第44行/users/ftf/www/ccache.php中的非对象上调用成员函数bind_param()部分代码来自ccache.php//NeuesDatenbank-Objekterzeugen$db=@newmysqli('localhost',

php - mkdir 函数抛出异常 'File exists' 即使在检查该目录不存在之后

我偶然发现了PHP中mkdir函数的每一个奇怪行为。下面是我的简单代码示例。$filepath='/media/static/css/common.css';if(!file_exists(dirname($filepath))){mkdir(dirname($filepath),0777,TRUE);}“媒体”文件夹始终存在。必须创建“媒体”文件夹中的所有文件夹。在处理common.css文件之前,我想创建一个文件夹“/static/css”。mkdir偶尔抛出异常“文件存在”。如果它不存在,我试图创建一个文件夹。我假设“文件存在”是一个常见错误,因此该文件夹存在。我知道我给你的信息

PHP 使用 preg_match 或正则表达式作为 array_search 的值或 array_keys_exist 的键

我想知道是否可以在array_seach()或array_keys_exist中使用正则表达式或preg_match()?即。array_keys_exist($array,"^\d+$")匹配所有纯数字字符的键 最佳答案 我不知道它是否完全符合您的需求,但您应该看看preg_grep函数,它将根据正则表达式检查字符串数组并返回所有匹配的数组元素。您可以对键执行相同操作,方法是在array_keys的返回值上使用preg_grep.这与array_search/array_key_exists在这方面不同,它们在找到匹配项后停止,因

php - ReflectionException "Cannot access non-public member",但属性可访问?

我正在以这种方式更改我的反射类的可访问标志:protectedfunctiongetBaseSubscriptionPeriodReflection(){$reflection=new\ReflectionClass('Me\Project\Class');//Makeallprivateandprotectedpropertiesaccessible$this->changeAccessibility($reflection,true);return$reflection;}protectedfunctionchangeAccessibility(\ReflectionClass$r

php - Symfony/Doctrine "refers to the owning side field which does not exist"- 但类中存在属性

SeUserProgress和SeUser。SeUserProgress表为每个用户保存多个条目。这通过以下两个映射表示。类:SeUserProgress/***@ORM\ManyToOne(targetEntity="SeUser",inversedBy="progress")*@ORM\Column(name="user_id",type="integer",nullable=true)*/private$user;类别:SeUser/***@ORM\OneToMany(targetEntity="SeUserProgress",mappedBy="user")*/private$

php - “The block type sonata.Admin.block.admin_list does not exist”

我是Symfony2的新手,在生成我的管理面板时遇到了这个问题。Anexceptionhasbeenoccurredduringtherenderingofatemplate("Theblocktypesonata.Admin.block.admin_listdoesnotexist")inSonataAdminBundle:Core:dashboard.html.twigatline35我正在关注此文档SonataAdminBundle. 最佳答案 你必须在app/config/config.yml中指定所有block,就像在th

php - 错误 : Call to a member function find() on a non-object in cakephp controller

我是cakephp的新手,并尝试使用控制台工具生成一些CRUD操作。它工作正常,除了一张table(最大的)。尝试添加新元素时,返回:Error:Calltoamemberfunctionfind()onanon-objectFile:C:\wamp\www\cakephp\app\Controller\ChantiersController.phpLine:50这是第50行及以后的代码:$programs=$this->Chantier->Program->find('list');$etats=$this->Chantier->Etat->find('list');$types=$

php - 即使 file_exists() 声明文件存在,require() 也会失败

这是我的代码:if(file_exists('config.php')){require('config.php');//Thisisline38}以某种方式产生错误:Warning:require(config.php)[function.require]:failedtoopenstream:Nosuchfileordirectoryin/path/name/file.phponline38这怎么可能?更新:以下确实有效:if(file_exists(getcwd().'/config.php')){require(getcwd().'/config.php');}