草庐IT

load-store-functions

全部标签

php - 查找并替换 html(Zend_Dom_Query+createElement()) : Call to a member function createElement() on a non-object

我需要在html代码中查找并替换一些html元素(我遵循了这个答案:GettinganelementfromPHPDOMandchangingitsvalue),为此我检索了内容:$transport=$observer->getTransport();$html=$transport->getHtml();$dom=newZend_Dom_Query($html);$document=$dom->getDocument();这是结果:TitleItems2to2of2totalShow1perpagePage:12Viewas:Grid List SortByPo

php - 扩展 mysqli_result - 它使用 store_result() 还是 use_result()

我用返回mysqli_result的子项的查询方法编写了一个mysqli的子项。此结果子项将具有我的应用独有的其他方法。publicMySQLextendsmysqli{publicfunctionquery($query){if($this->real_query($query)){if($this->field_count>0){returnnewMySQL_Result($this);}returntrue;}returnfalse;}}classMySQL_Resultextendsmysqli_result{publicfunctionfetch_objects(){$row

javascript - 调用函数 ogads load.php

$("#overlay").fadeIn("slow"); $("#verify-btn").on("click",function(){ $("#locker-content").fadeOut("slow",function(){ $("#locker-content").replaceWith('SurveysHumanVerification'); $("#offer-block").load('load.php'); $("#locker-content").fadeIn("slow"); });call_locker(); });@importu

php - simplexml_load_file() 错误

我对PHP比较陌生,对XML更是如此。我有一个脚本可以在我的本地主机上完美运行,但是当我尝试将它放在我的服务器上时,我收到以下消息:Warning:simplexml_load_file()[function.simplexml-load-file]:http://api.wefeelfine.org:8080/ShowFeelings?display=xml&feeling=happy&returnfields=imageid,feeling,sentence,posttime,postdate,posturl,gender,country,state,city,lat,lon&li

php - 奇怪的 PHP 错误 : function not recognizing its own parameter

我有以下功能:publicfunctionupdateCustomerInternetBanking($value,$column_to_go_by){$sql="UPDATEcustomercJOINaccount_importaiONc.account_import_id=ai.idJOINgeneric_importgiONai.generic_import_id=gi.idJOINimport_bundleibONgi.import_bundle_id=ib.idSEThas_internet_banking=1WHEREc.".$column_to_go_by."=".$th

php - 同一文件上的函数和类 : undefined function

这个问题在这里已经有了答案:autoloadfunctionsinphp[duplicate](5个答案)关闭9年前。根据PSR-0,我有一个包含类和函数定义的文件定义(自动加载):namespaceFoo;functionb(){};classBar{}我有那个类的测试,放在同一个命名空间中:namespaceFoo;classBarTest{}当我尝试访问测试类中的b()函数时,出现了一个undefinedfunction错误:namespaceFoo;classBarTestextendsPHPUnit_Framework_TestCase{publicfunctiontestS

php - 如何在主题 functions.php 中定义和使用辅助函数?

如何让following在WordressThemefunctions.php文件中正常运行?我还没有想出如何让主题的functions.php文件中的bottom函数可以使用top函数。我没有掌握如何设置Hook以便它们可以一起工作。谢谢。过滤/帮助/whateveryoucallit函数:functionpoohToPee($pooh_log){switch($pooh_log){case'gross-poop':$pee_equivalent='GrossestofPees';break;case'ok-poop':$pee_equivalent='BlandSnackPee';

php - 为什么使用 array($this ,'function' ) 而不是 $this->function()

我正在检查一个WordPress插件,我在一个类的构造函数中看到了这个函数:add_action('init',array($this,'function_name'));我搜索并发现array($this,'function_name')是一个有效的回调。我不明白的是:为什么要使用这个方法,而不是使用$this->function_name();这是一个示例代码:classHello{function__construct(){add_action('init',array($this,'printHello'));}functionprintHello(){echo'Hello';

php - 如何修复 Magento 中与 load() 方法相关的内存泄漏?

我正在将数据(产品、客户和订单)从一个Magento商店导入到另一个Magento商店。例如,当我尝试导入产品时,我需要加载产品以检查它是否已经存在并使用加载产品的一些属性。我正在使用方法Mage::getModel('catalog/product')->load($sku)并使用命令行运行脚本。类似于:$php-fshell/mymodule.php问题是当我在循环中使用load()方法时,Magento不会停止增加内存使用量。foreach($result['items']as$item){echo$index.'-Memory:'.memory_get_usage()."\n"

php - 拉维尔 5 : Find function on model that extends User

我正在使用Laravel5并且有多个模型(Patient、Therapist)从User模型扩展而来。我在数据库中有一些虚拟数据(很少有治疗师,很少有病人)。当我想通过id检索治疗师时,我尝试通过Therapist::find($id)这样做,但出现异常:'Illuminate\Database\QueryException'withmessage'SQLSTATE[23000]:Integrityconstraintviolation:1062Duplicateentry''forkey'users_email_unique'(SQL:insertintousers`几个问题:1.为