草庐IT

a_function_that_may_fail

全部标签

php - 试图调用方法 : undefined function error

我有一个类可以连接到我的数据库,从数据库查询中剥离内容并返回内容。无论如何,我遇到的问题是我正在尝试调用runQuery()方法,但每次尝试时,我都会收到此错误:Fatalerror:CalltoundefinedfunctionrunQuery()inDatabaseConnector.phpline22也许有什么想法?我知道runQuery是私有(private)的,但它在同一个类中。只是为了好玩,我以任何方式将其更改为公开,但仍然出现相同的错误:(finalclassDatabaseConnector{private$db;publicfunctionDatabaseConnec

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 - fatal error : call to undefined function mb_strtolower() in OpenCart

这个问题在这里已经有了答案:Fatalerror:Calltoundefinedfunctionmb_strtolower()(4个答案)关闭8年前。我正在使用opencart1.5.6这周我遇到了一次严重的服务器崩溃,不得不对服务器进行镜像恢复。现在一切都恢复正常,除了现在在opencart中,当我尝试以客户身份登录或去结账时,我收到此错误并且不知道如何解决它。SyntaxError:JSON.parse:unexpectedcharacteratline1column1oftheJSONdataFatalerror:Calltoundefinedfunctionmb_strtolo

php - 无法打开流 : HTTP request failed! HTTP/1.0 400 错误请求

这是我用来查找地点的纬度和经度的代码:functioncoords($address){echo$url="http://maps.googleapis.com/maps/api/geocode/json?address=".$address;$json=file_get_contents(urlencode($url));$data=json_decode($json,TRUE);print_r($data['results'][0]['geometry']['location']['lat']);print_r($data['results'][0]['geometry']['lo

php - Uncaught Error : Call to undefined function mysql_select_db()

我正在尝试从数据库中获取数据,但出现此错误。Fatalerror:UncaughtError:Calltoundefinedfunctionmysql_select_db()inE:\xamp\htdocs\PoliceApp\News\fetch.php:10Stacktrace:#0{main}throwninE:\xamp\htdocs\PoliceApp\News\fetch.phponline10我怎样才能做到这一点? 最佳答案 应该是mysqli_select_db($dbhandle,"police")其他mysql_

php - Symfony Knp 菜单包 : set active a menu item even when its not on that menu

我创建了我的菜单生成器并且它有效。我的路线之一是/database但这有一个子路由:database/view/{id}我不想将View路由放入菜单项中,因为没有ID它就无法工作。但我希望当用户在View中时数据库路由处于事件状态。我该怎么做? 最佳答案 设法用这个小技巧解决了它:在添加所有子项之后但在返回我添加的菜单之前的menuBuider中$request=$this->container->get('request');$routeName=$request->get('_route');switch($routeName)

php - 内存泄漏?!在 'create_function' 中使用 'array_map' 时,垃圾收集器是否正常运行?

我在StackOverflow上找到了以下解决方案,可以从对象数组中获取特定对象属性的数组:PHP-Extractingapropertyfromanarrayofobjects建议的解决方案是使用array_map并在其中使用create_function创建一个函数,如下所示:$catIds=array_map(create_function('$o','return$o->id;'),$objects);会发生什么?:array_map遍历每个数组元素,在本例中是一个stdClass对象。首先它创建一个这样的函数:function($o){return$o->id;}其次,它为当

php - WordPress - PHP fatal error : Call to undefined function get_bloginfo()

我正在将一个外部脚本与我的wordpress主题集成,但我在我的一个文件中遇到了这个错误:PHPFatalerror:Calltoundefinedfunctionget_bloginfo()这个脚本位于themes/mytheme/myscript所有文件包含如下:include(WP_CONTENT_DIR."/themes/mytheme/myscript/myfile.php");我该如何解决? 最佳答案 问题通常与mysql相关...您需要重置您的wordpress数据库用户密码。也就是说wordpress数据库用户的pa

PHP 的 create_function() 与仅使用 eval()

在PHP中,您有create_function()函数,它创建一个唯一的命名lambda函数,如下所示:$myFunction=create_function('$foo','return$foo;');$myFunction('bar');//Returnsbar这实际上是不是更好(除了更容易)然后做:do{$myFunction='createdFunction_'.rand();}while(function_exists($myFunction));eval("function$myFunction(\$foo){return\$foo;}");$myFunction('bar

php - 奏鸣曲管理包 : possible to add a child admin object that can have different parents?

我正在使用原则继承映射来使各种对象链接到评论实体。这是通过各种具体的“线程”实现的,这些线程与评论具有一对多的关系。所以以'Story'元素为例,会有一个相关的'StoryThread'实体,它可以有很多评论。一切正常,但我在尝试为SonataAdminBundle定义CommentAdmin类时遇到了麻烦,该类可用作父实体的子实体。例如,我希望能够使用如下路线:/admin/bundle/story/story/1/comment/list/admin/bundle/media/gallery/1/comment/list有没有人对我如何实现这一目标有任何指示?我很想发布一些代码摘录