草庐IT

boolean_field

全部标签

php - Boolean和Integer是序列化后的字符串

我正在使用WordPressupdate_post_meta像这样保存一个数组$obj=array('array'=>array(1,'zwei',!!3),'string'=>'abc','bool'=>true,'bool2'=>false,'integer'=>1,'integer2'=>17);update_post_meta($post_ID,'my-key',$obj);但是如果我检查我得到的原始字段a:6:{s:5:"array";a:3:{i:0;i:1;i:1;s:4:"zwei";i:2;s:1:"1";}s:6:"string";s:3:"abc";s:4:"bo

PHP:strtotime 返回类型为 "nothing"的 "boolean"

我有变量$EDate,我使用strtotime函数和这个具有不同值的变量,结果如下:$EDate=10-21-2013;echo"strtotime($EDate)";theresult=nothingandthetypeisboolean$EDate=09-02-2013;echo"strtotime($EDate)";theresult=1360386000andthetypeisinteger$EDate=09-30-2013;echo"strtotime($EDate)";theresult=nothingandthetypeisboolean$EDate=09-30-2013

php - Silverstripe 管理员 : "Has one" dropdown converts to ordinary input field after import

我在Silverstripe的管理员方面遇到了一些问题。我定义了一个数据库模型(请参阅下面的类定义),在我进行开发/构建之后,一切看起来都符合预期。当我尝试添加一个新的“包”时,所有“有一个”字段都带有下拉列表(请参见屏幕截图1)。我还构建了一个导入这些包的导入器。运行时,一切看起来都很好,除了打开包裹时。然后“节日”正确耦合。您可以看到名称,并且可以选择下拉列表。另一方面,“剧团”已经神秘地转换为一个输入字段,该字段仅显示另一个表中记录的ID(参见屏幕截图2)。有人知道这里发生了什么吗?是否有什么东西触发了我没有意识到的这种行为?我的代码有问题吗(是的,但与此问题有关?;-))?我检

php - Custom Drupal 7 Field 只保存第一个字符

我实际上是在尝试使用新的Drupal7FieldAPI创建我的第一个字段类型模块。我设法让它在“编辑”View中正确显示。但是,当我尝试保存一些数据时,它只保存了第一个字符。这是模块:array('label'=>t('Youtubevideo'),'description'=>t('ThisfieldstoresayoutubevideoIDanddisplaysthevideoassociatedwithit'),'settings'=>array('max_length'=>11,),'instance_settings'=>array('text_processing'=>fa

php - Zend Framework : setting a Zend_Form_Element form field to be required, 我如何更改用于确保元素不为空的验证器

当使用Zend_Form时,验证输入是否留空的唯一方法是做$element->setRequired(true);如果未设置且元素为空,在我看来,验证未在元素上运行。如果我确实使用了setRequired(),该元素会自动获得标准的NotEmpty验证器。问题是这个验证器的错误消息很糟糕,“值是空的,但需要一个非空值”。我想更改此消息。目前,我已经通过更改Zend_Validate_NotEmpty类来完成此操作,但这有点hacky。理想情况下,我希望能够使用我自己的类(派生自Zend_Validate_NotEmpty)来执行非空检查。 最佳答案

php - boolean 针可以传递给 in_array 吗?

我可以将false作为针传递给in_array()吗?if(in_array(false,$haystack_array)){return'!';}else{return'C';}$haystack_array将只包含boolean值。干草堆表示多个写入查询的结果。我试图找出其中是否有任何返回错误,因此未完成。 最佳答案 PHP不会关心您作为“针”传入的内容,但您可能还应该为in_array使用第三个(可选)参数以使其成为“严格”比较。PHP中的“false”将测试为等于0、''、""、null等。..

php - 谷歌云端硬盘 API v3 : Invalid field selection

我正在使用GoogleDriveAPIv3访问有关驱动器的空间配额。而且,无论我做什么,我都会遇到这个错误:Fatalerror:Uncaughtexception'Google_Service_Exception'withmessage'Errorcalling**GEThttps://www.googleapis.com/drive/v3/about?fields=name**:(400)Invalidfieldselectionname'in/var/webs/includes/google-api-php-client/src/Google/Http/REST.php:110S

php - Doctrine2 和 Postgres : Invalid input syntax for boolean : ""

SQLSTATE[22P02]:Invalidtextrepresentation:7ERROR:invalidinputsyntaxfortypeboolean:""500InternalServerError-PDOException这是由Doctrine2(2.2-DEV)引起的错误消息,恐怕是再次出现的错误:http://www.doctrine-project.org/jira/browse/DDC-1394导致该错误的查询如下:publicfunctiongetFindAllNonOthersQueryBuilder(){return$this->createQueryBu

php - 教义 - [语义错误] - 错误 : Class has no field or association

我正在尝试使用Doctrine的DQL运行查询在存储库中,我收到以下错误:QueryExceptioninQueryException.phpline63:[SemanticalError]line0,col100near'test_suite_id':Error:ClassApplication\Model\Entity\Pagehasnofieldorassociationnamedtest_suite_id协会一个User可以有多个TestSuite。一个TestSuite可以有多个Page。因此,我在User和TestSuite以及TestSuite和Page分别。以下是我的实

php - Symfony/Doctrine "refers to the owning side field which does not exist"- 但类中存在属性

SeUserProgress和SeUser。SeUserProgress表为每个用户保存多个条目。这通过以下两个映射表示。类:SeUserProgress/***@ORM\ManyToOne(targetEntity="SeUser",inversedBy="progress")*@ORM\Column(name="user_id",type="integer",nullable=true)*/private$user;类别:SeUser/***@ORM\OneToMany(targetEntity="SeUserProgress",mappedBy="user")*/private$