草庐IT

Base_Object

全部标签

php - Symfony2 404 错误 : Object Not Found (ParamConverter error)

我创建了一个名为search.html.twig的新边界类,但是当我转到URL(http://localhost:8000/shrubs/search)时,出现以下错误:ERROR-UncaughtPHPExceptionSymfony\Component\HttpKernel\Exception\NotFoundHttpException:"AppBundle\Entity\Shrubsobjectnotfound."atC:\Users\rosmith\shrub_search\vendor\sensio\framework-extra-bundle\Request\ParamCo

php - 如何在插件中定义 JPATH_BASE?

我想在我的插件中访问joomla环境并添加这些代码行(我的来源:http://www.diademblogs.com/content-management-systems/two-ways-to-add-joomla-users-using-your-custom-code):define('_JEXEC',1);define('JPATH_BASE',dirname(__FILE__));//thisiswhenweareintherootdefine('DS',DIRECTORY_SEPARATOR);require_once(JPATH_BASE.DS.'includes'.DS

PHP - 关联数组 : Changing keys for key value pair where value is a class object

我有一个形式的关联数组:$input=array("one"=>,"two"=>$input的键保证是唯一的。我还有一个名为moveToHead($key)的方法,它将$input[$key]元素移动到此关联数组的第0个位置。我有几个问题:是否可以确定关联数组的索引?如何将对应的$key=>$value对的数组条目移动到索引0并保留$key原样?实现上述两点的最佳方法是什么?我想为第二点做array_flip(子解决方案),但后来发现array_flip只能在数组元素为int和string时完成。有什么指点吗? 最佳答案 使用名为a

PHP json_decode() 输出 : Object vs Array?

按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visitthehelpcenter指导。关闭9年前。对于函数json_decode(),输出有2个选项,JSONObject或Array。$obj=json_decode($json_string,false);或$array=json_decode($json_string,true);哪种类型表现更好?

php - TYPO3 扩展库 : How to access "modified" flag of my object property?

我经常使用ExtbaseDebugUtility(Tx_Extbase_Utility_Debugger::var_dump($object))。它显示每个属性的附加数据,尤其是“已修改”标志-请参见屏幕截图。如何从我的Controller(updateAction)中访问这个“元属性”?我尝试了$object->getProperty->isModified和其他组合,但无济于事。 最佳答案 有一个方法$yourObject->_isDirty("propertyName")如果它被修改则返回true(参见documentatio

php - 错误 : Using $this when not in object context

这个问题在这里已经有了答案:PHPFatalerror:Using$thiswhennotinobjectcontext(9个回答)关闭9年前。我已经查找了涵盖此错误的其他问题,但找不到适用于我的问题的案例。基本上,我的类中的静态方法调用一个非静态方法,该方法反过来调用另一个非静态方法。这会引发fatalerror:Fatalerror:Using$thiswhennotinobjectcontextinclass.phponline...我不明白为什么不能通过$this从另一个非静态类方法调用一个非静态类方法。是因为它们都是从静态函数调用的,因此没有$this实例吗?这是(简化的)类

php - 处理您的请求时出错 : SQLSTATE[42S01]: Base table or view already exists: in magento 1. 9

我已经在我的本地服务器上安装了magento1.9CE,它工作正常。突然它停止工作并显示错误TherehasbeenanErrorprocessingyourrequest.当我从报告文件夹中检查错误报告时,我得到了类似这样的日志a:5:{i:0;s:219:"Errorinfile:"C:\wamp\www\anzonline\app\code\core\Mage\XmlConnect\sql\xmlconnect_setup\upgrade-1.6.0.0-1.6.0.0.1.php"-SQLSTATE[42S01]:Basetableorviewalreadyexists:105

php - 如何测试 base64 字符串是否是 PHP 中的有效图像?

这个问题在这里已经有了答案:PHPValidatebase64encodedimages(5个答案)关闭11个月前。如何在PHP中测试base64字符串是否为有效图像?我尝试了以下代码:functionconvertAndSaveLogo($data,$id){if(isset($data->base64_image)&&$data->base64_image){$imageData=base64_decode($data->base64_image);if($imageData){$source=imagecreatefromstring($imageData);if($source

php - 无效配置 - yii\base\InvalidConfigException - Yii2

我刚刚通过此命令将Yii2-User模块/Dektrium安装到我的Yii2-app-basic应用程序中composerrequire"dektrium/yii2-user:0.9.*@dev"config/console.phpreturn[..'modules'=>['gii'=>'yii\gii\Module','user'=>['class'=>'dektrium\user\Module',],],..]config/web.php'components'=>[../*'user'=>['identityClass'=>'app\models\User','enableAut

PHP 每晚 : Parameter must be an array or an object that implements Countable

我看到了UTfailures在aPHPwebapp每晚在TravisCI中针对PHP运行:$php--versionPHP7.2.0-dev(cli)(built:Dec4201622:49:34)(ZTS)这是失败的测试用例:$payments=PaymentsHelper::refunds('DE0000000001','2016-04-01','2017-04-01');$this->assertNotNull($payments);$this->assertEquals(0,count($payments));测试失败1)PaymentsHelperTest::test_ref