草庐IT

field-container

全部标签

php - Symfony2 - 文件下载和 'The filename fallback must only contain ASCII characters.' 错误

在这里使用Symfony2.5,用户将MSOffice文件上传到我们的应用程序中,并在以后根据需要下载。现在,当文件附件包含非ASCII字符时(这很常见,因为我们来自捷克共和国),Symfony会引发错误“文件名回退必须仅包含ASCII字符。”我发现了很多关于这个问题的报告和讨论,例如https://github.com/symfony/symfony/issues/9093...但没有真正的解决方案。我知道我可以在制作Content-Dispositionheader时将文件名转换为ascci,但它会更改呈现给用户的文件名,这对用户来说不是很好而且很容易误导。有没有办法避免这种情况并

php - Symfony2 : How to set default value for a field DateTime

我使用Symfony2.8我有一个名为“Docentes”的表,其中包含一个日期时间字段“fechaAlta”我需要在添加新记录时此字段的默认值为“今天”我生成CRUD,使用命令generate:doctrine:crud在文件“DocentesController.php”中,Symfony创建了两个函数:“newAction”和“editAction”(以及其他函数)。两者都使用相同的表单,将“DocentesType.php”文件插入“表单”文件夹中:publicfunctionbuildForm(FormBuilderInterface$builder,array$option

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 - Foursquare field 签到授权错误

我正在尝试使用以下地址显示field签到列表:https://api.foursquare.com/v2/venues/VENUE_ID/stats?oauth_token=OAUTH_TOKEN我已经注册了Foursquare应用程序并将我网站的URL指定为重定向URL。我获得了我的客户凭证并按照https://developer.foursquare.com/overview/auth中的说明进行操作创建我的代码和access_token。但是,当我尝试访问这些统计信息时,我的网络浏览器出现错误:{"meta":{"code":403,"errorType":"not_author

php - mysqli中的位标志是什么意思使用fetch_field_direct

使用mysqli,我可以像这样获取有关字段的信息$field=mysqli_fetch_field_direct($result,$fieldCount);我可以使用从结果中获取字段标志$field->flagsPHP手册说这会返回“一个表示字段位标志的整数”。但这就是我能找到的所有信息。我如何解释位标志?到目前为止,我已经解决了这个问题整数(字段长度无关紧要)根据指定的属性返回以下位标志:primarykey49967primary&unique53255uniquekey53251foreignkey53257unique&index53259(Autoincrement49675

php - SilverStripe $summary_field 中断标签翻译

我在我的DataObject中使用publicfunctionfieldLabels()来翻译所有字段标签(以及$summary_fields的标签)。这适用于所有字段,但具有从函数返回值(而不是从数据库中提取的值)的字段除外。摘要字段static$summary_fields=array('Label'=>'Label','Type'=>'Type','getRequiredLabel'=>'Required');字段标签publicfunctionfieldLabels($includerelations=true){$labels=parent::fieldLabels(true