草庐IT

contains

全部标签

php - 当 Firefox 显示 "the Image cannot be displayed because it contains errors"时,我如何找出错误是什么?

我有一个制作图像的PHP文件。我将PHP配置为在屏幕上报告错误。当我在Firefox23中运行PHP文件中的文件时,它返回TheImagecannotbedisplayedbecauseitcontainserrors。我如何找出图像中的特定错误?代码如下:0)and(!$xend)){$y=0;while(($y1andfunction_exists('imagesetbrush')){$brush=imagecreatetruecolor($brushsize,$brushsize);imagefill($brush,0,0,$noisecol);imagesetbrush($im

php - Symfony @ParamConverter : exclude the use if the placeholder does not contain a dot

我有这个Controller:/***{@inheritdoc}**@Route("entity/{domain_host}")*@ParamConverter("entity",class="AppBundle:Entity",options={*"repository_method"="findOneByDomainHost",*"mapping":{"domain_host":"domainHost"},*"map_method_signature"=true*})*/classEntityControllerextendsController{...}通过这种方式,像http:

php - 身份验证凭证未找到异常 : The security context contains no authentication token

我收到以下错误AuthenticationCredentialsNotFoundException:Thesecuritycontextcontainsnoauthenticationtoken.OnepossiblereasonmaybethatthereisnofirewallconfiguredforthisURL.我已经尝试过解决方案,因为我知道当没有为路由配置安全防火墙时会发生此错误,但我似乎无法解决该错误。这是我的security.ymlsecurity:access_decision_manager:#strategycanbe:affirmative,unanimous

php - 正则表达式帮助 : how to match only either pattern in a regex that contains "or" operator?

我正在使用php的preg_replace().基本上我有2种可能的字符串匹配:你好现实世界问候这是我希望完成的:HelloRealWorldGreetings规则解释:如果字符串包含空格,插入在第一个空格字符之后。如果字符串不包含空格(一个单词),则插入就在字符串的中间(+/-如果奇数字符计数)。到目前为止,我已经想出了一个长期有效的解决方案:",$str,1):preg_replace("/.{".round(strlen($str)/2)."}/","$0",$str,1);?>但是,我相信它可以通过一个更短、更优雅的正则表达式来完成,只有一个preg_replace()。打电话

PHP Predis : how to get/delete keys containing special characters?

我需要删除一个包含一些特殊键的键(在我的例子中是方括号):我做了以下,但它不起作用:$this->redis;$keys=$this->redis->keys("*");foreach($keysas$key){//keysareinthefollowingformat://vir3_data_cache[zones_cdc_shifting_series_2013_5][1]$this->redis->del($key);//nokeywasdeleted}我也尝试引用key,但没有成功:$this->redis;$keys=$this->redis->keys("*");forea

PHP 教义 : Test if an object is in an ArrayCollection

我正在尝试使用方法ArrayCollection::contains来查找对象是否已经在我的集合中,但是当我这样做时://MyArrayCollection$lesRoles=$drt->getDrtApplication()->getRoles();$leRole=$lesRoles->first();echo"PropertyappNom:".$leRole->getRleApplication()->getAppNom()."//PropertyappRole:".$leRole->getRleId()."";$role=new\Casgaya\Role(2,$drt->getD

java - PHP 问题 : filesize() return 0 with file containing few data?

我使用PHP调用Java命令,然后将其结果转发到名为result.txt的文件中。例如,该文件包含以下内容:“结果是:5.0”但是函数filesize()返回0,当我通过“ls-l”命令检查时,它也是0。因为我决定在文件大小!=0时将结果打印到屏幕上,所以什么都不打印。我怎样才能得到位的大小?或其他可用的解决方案? 最佳答案 来自docs,当您调用filesize时,PHP会将此结果缓存在stat缓存中。您是否尝试过清除统计缓存?clearstatcache();如果它不起作用,可能的解决方法是打开文件,找到它的末尾,然后使用fte

php - Laravel 5.5 - 检查字符串是否包含确切的单词

在laravel中,我有一个$string和一个$blacklistArray$string='Cassandraisacleanwordsoitshouldpassthecheck';$blacklistArray=['ass','ballsack'];$contains=str_contains($string,$blacklistArray);//true,containsbadword$contains的结果为真,因此这将被标记为包含黑名单词(这是不正确的)。这是因为下面的名称部分包含assC屁股安德拉但是,这是部分匹配,Cassandra不是坏词,因此不应标记它。只有当字符串

php - Composer Install (own Container) with Docker missing PHP Extensions

我目前正在学习Docker,并使用了2周。现在我有一个非常简单的任务,通过Composer安装PHP库。这通常是在没有Docker的情况下工作:composerinstall现在因为我在使用Docker,我发现有一个Docker容器,它为我保存了composer:dockerrun--rm-v$(pwd):/appcomposer/composerinstall这工作得很好,但是有一些库需要安装特定的php库,比如bcmath,所以我将它添加到我的DockerfileFROMphp:7.0-apacheRUNdocker-php-ext-installbcmath当我重建容器时,此代码

PHP Xpath : Get all href's that contain "letter"

假设我有一个已加载的html文件,我运行此查询:$url='http://www.fangraphs.com/players.aspx';$html=file_get_contents($url);$myDom=newDOMDocument;$myDom->formatOutput=true;@$myDom->loadHTML($html);$anchor=$xpath->query('//a[contains(@href,"letter")]');这给了我这些anchor的列表,如下所示:Aa但我需要一种方法来只获取“players.aspx?letter=Aa”。我想我可以试试:$