草庐IT

built-in-types

全部标签

php - Reason for Undefined class constant NOTICE in PHP (未定义常量的使用)

我在我的代码中发现了一个关于类常量的奇怪问题。虽然看起来代码确实可以正常工作,但我无法弄清楚我收到PHPNotice的原因:使用未定义的常量PAYMENT_ERROR-假定/src/Micro/Payments/Manager.php第146行中的“PAYMENT_ERROR”Manager.php函数中的代码如下所示:$code=Result::PAYMENT_ERROR;returnnewResult($code,$errMsg);//令我感到奇怪的是,$code变量设置正确并且不会触发任何通知。只有实例化Result才可以。Result类非常简单:classResult{//..

php - MVC : Instantiate Controller In Router?

我想弄清楚从路由器类中启动Controller是否是不好的做法。从我所能找到的一点点,有人说路由器不应该处理实例化Controller。下面是我如何开始开发我的路由器类。示例(注意为了打字我省略了很多。)classRouter{private$url,$controller;publicfunction__construct($url){$this->url=$url;$this->map();/*mapsurltocontrollerandaction*//*dispatchcontroller*/$this->dispatch();}privatefunctiondispatch(

php - Zend 框架 2 : Set options as "selected" in select list

我正在尝试将第二个产品设置为在列表中选中,但下面的代码不起作用。任何的想法。谢谢$this->add(array('type'=>'Zend\Form\Element\Select','name'=>'manufacturer','options'=>array('label'=>'Manufacturername','value_options'=>$this->getManufacturer(),'empty_option'=>'---selectmanufacturer---',),'attributes'=>array('value'=>2,'selected'=>true,)

php - fatal error : Call to undefined function asset() in C:\wamp\www\laravel-master\app\views\hello. PHP

我想学习laravel框架。我可以在我的网络服务器(Wamp)中安装laravel,我得到了一些学习它的教程,但是当我尝试将样式添加到hello.php文件中的“h1”标签时,位于该路径中:(“C:\wamp\www\laravel-master\app\views\hello.php")通过asset()函数,出现上述错误。请帮我找出问题所在。这是hello.php代码:body{margin:0;font-family:'Lato',sans-serif;text-align:center;color:#999;}.welcome{width:300px;height:200px;

php - ImageMagick 和 imagick_type_gen 无法识别添加的字体

好的,我正在运行CentOS服务器、PHP5.4.440和ImageMagick6.5.4,并且我正在尝试添加其他字体,例如Lobster。这是我到目前为止所做的:上传Lobster.ttf到/home/myusername/fonts/从SSH,运行“perlimagick_type_gen>fonts.xml”。这导致字体文件很大,但没有包含对Lobster.otf或Lobster.ttf的引用相反,我生成了自己的type.xml并将其保存到/home/myusername/.magick/。这是标记:通过SSH,我编辑了/user/lib64/ImageMagick-6.5.4/

php - WordPress: fatal error :调用未定义函数 is_user_logged_in()

我正在wordpress页面中加载一个PHP脚本,但是当脚本运行时我得到了这个:Fatalerror:Calltoundefinedfunctionis_user_logged_in()它尝试运行的代码:我尝试寻找答案,但找不到可行的解决方案。根据我在互联网上发现的内容,我的脚本在wordpress之外运行,这就是它找不到函数的原因。 最佳答案 也许您运行代码的时间过早,如此处所述:https://wordpress.org/support/topic/fatal-error-call-to-undefined-function-i

php - 解析用户 : Cannot use object of type __PHP_Incomplete_Class as array

我想用Parse来保存数据。我使用ParseUser来保存用户。文档here.当我这样做时,我有一个ParseUser对象:$user=new\Parse\ParseUser();$user->set("username","myname");$user->set("password","mypass");$user->set("email","email@example.com");var_dump($user);exit();但是如果我尝试使用signUp方法。文档here.像这样:$user=new\Parse\ParseUser();$user->set("username",

php - 错误 : Transport config "Smtp" is missing in cakephp 3. x

cakephp3.x中缺少传输配置“Smtp”我试过一些配置如下:'EmailTransport'=>['default'=>['className'=>'Smtp','host'=>'ssl://smtp.gmail.com','port'=>465,'username'=>'xxxxxxxxx@gmail.com','password'=>'xxxxx',],],'Email'=>['default'=>['from'=>array('site@localhost'=>'DataMining'),'transport'=>'Smtp','charset'=>'utf-8','hea

php - 问题安装 prestashop 模块 : mymodule(class missing in/. ..)

我是prestashop模块开发的新手,我似乎无法让它工作。我一步一步地按照教程进行操作,但是当我安装模块时,我总是得到这个“Mymodule(/modules/Mymodule/test-module.php中缺少类)”。我在网上查了一下,似乎当php文件不是用没有BOM的UTF-8编码时会发生这个错误,但即使这样做也不起作用。这是我的代码,希望有人能找到问题所在:name='CookiesPresta';$this->tab='front_office_features';$this->version='1.0';$this->author='memyself';$this->ne

php - While in while 只显示一行?

我有两个SQL表,一个包含“手动插入的数据”,另一个包含“通过脚本自动插入的数据”。为了测试脚本是否正常运行,手动表和自动表是一样的。所以,我想“比较”两个数据库,然后在另一个脚本中突出显示差异。//$currentdate_today_midnightisatimestamp$sql_getLive="SELECT*FROMworksheetsWHEREentry_date>$currentdate_today_midnight";$req_getLive=$cnx->query($sql_getLive);$req_getLive->setFetchMode(PDO::FETCH_