草庐IT

ERROR_NO_MATCH

全部标签

php - 如何使用 preg_match 提取 img src

我有不同格式的html数组[amp;src]=>image,anotherone[posthtml]=>image2,anothertwo[nbsp;image3如何使用常用的preg_match()提取img和文本,通过它我们可以从html中得到完美的图像src和文本。如果无法使用preg_match(),是否有另一种方法来修复它。有知道的请回复一下。如何修复它。我需要你的手。 最佳答案 推荐的方式是使用DOM$dom=newDOMDocument;$dom->loadHTML($HTML);$images=$dom->getEl

php - fatal error : Using $this when not in object context

我收到此fatalerror消息:不在对象上下文中时使用$this。此类在CodeIgniter中设置为一个库。这是我的课:classMy_class{function__construct(){$this->app=base_url('application').'/cache/';if($this->expire_after==''){$this->expire_after=300;}}staticfunctionstore($key,$value){$key=sha1($key);$value=serialize($value);file_put_contents($this->

PHP preg_match 汽车牌照

所以前几天我刚刚了解了PHP中的preg_match,现在我正在尝试preg_match车牌。它应该检查这个:9a-4e-yy,所以-和数字或字母前后,然后是-和更多数字或字母。但它必须恰好是彼此相邻的2个数字或字母,不能更多。现在我有这段代码:returnpreg_match("/^([0-9])"."([0-9])"."(\-([0-9])"."([0-9]))"."(\-([0-9])"."([0-9]))$/",$kenteken);但这只会检查数字。我希望你们能帮助我让它也能处理字母。提前致谢! 最佳答案 [0-9]只匹配

php - “对私有(private)方法的 fatal error 调用”但方法受到保护

第一次在PHP中扩展一个类时,我收到一个fatalerror,提示该方法是私有(private)的,而实际上它不是。我确定这是基本的东西,但我已经研究过书籍和论坛,但我无法确定我做了什么来产生这个错误。非常感谢任何帮助。详情如下:错误信息:Fatalerror:Calltoprivatemethodtestgiver::dbConnect()fromcontext'testprinter'in/root/includes/classes/testprinter.phponline726下面代码中testprinter的第726行:privatefunctionbuildquestion

php - Yii。如何添加 css "error"类以在表单提交时输入?

我有Yii形式。一些字段是必需的。提交表单时,我需要将CSS类“error”添加到文本输入中。我的代码:beginWidget('CActiveForm',array('id'=>'contact-form','enableClientValidation'=>true,'clientOptions'=>array('validateOnSubmit'=>true,),));?>labelEx($model,'name');?>textField($model,'name',array('class'=>'input'));?>error($model,'name');?>...现在我

php - 无法使用 gmail SMTP 在 Zend 中发送电子邮件。收到 fatal error : Uncaught exception 'Zend_Mail_Protocol_Exception' . 如何解决?

我正在尝试使用GmailSMTP发送电子邮件。以下是我的代码。$mail=newZend_Mail();$config=array('ssl'=>'ssl','port'=>'465','auth'=>'login','username'=>'username@gmail.com','password'=>'mypassword');$transport=newZend_Mail_Transport_Smtp('smtp.gmail.com',$config);$sendNow=$mail->setBodyHtml($message)->setFrom('username@gmail.

php - preg_match() 期望参数是给定的长字符串

我正在检查信用卡字段以确保它们每个都包含四位数字。functioncreditcard($creditCard1,$creditCard2,$creditCard3,$creditCard4){$regexp="/^[0-9]{4}$/";if(preg_match($regexp,$creditCard1,$creditCard2,$creditCard3,$creditCard4))//line18{returnTRUE;}else{echo'alert("Enteravalidcreditcardnumber.")';returnFALSE;}}$creditCard1=$_PO

php - ftp_connect fatal error : call undefined function

出于某种原因,ftp_connect()函数不起作用,当我尝试使用它时,它以fatalerror结束,指出此函数未定义...令人惊讶的是我仍然可以使用ftp客户端或使用ftp连接通过终端。我该如何解决这个问题?我在MountainLion上运行,我有5.3php版本-我重新安装了一次,希望这能解决我的问题。 最佳答案 检查PHPFTPinstallationmanual在PHP7上,您可以通过将此行添加到php.ini文件来启用它。extension=php_ftp.dll在PHP8+上启用php.ini中的这一行:extensio

php - 反序列化()[函数。反序列化] : Error at offset 49151 of 49151 bytes

在将对象存储到数据库中而不是检索它之后,我像网站上的许多人一样出现了偏移错误。如果我不存储它一切正常:$serializedObject=serialize($this);$unSerializedObject=unserialize($serializedObject);此外,我在保存数据和从数据库中检索数据时使用base64编码,但这无济于事。我没有做任何逃避。我的对象处理一些字符串。我发现这个字符串:Awomanistravellingaroundtheworld.Sheis28yearsoldandsheisfromGreatBritain.Shecannotuseacaror

php - Symfony 2 Embedded Forms: Catchable Fatal Error: Argument 1 passed to Entity::addProperty must be an instance of XX\MyClass, 数组给定

我已经读过this和this和其他人,但没有人解决我的问题。我已经删除了所有可能的内容并将范围缩小到一个字段:地址。当我尝试关注thistutorial时,如果我遵循它,一切都会正常,从一个全新的新项目开始。但是当我在我的其他项目中手动执行时,我得到了这个错误:“可捕获的fatalerror:传递给BN\Bundle\MyBundle\Entity\PersonTeacher::addAdresse()的参数1必须是BN\Bundle\MyBundle\Entity\Adresse的实例,C:\Users\Olivier\PhpstormProjects\中给出的数组My\My\src