草庐IT

false_type

全部标签

php - 如何使用 TinyButStrong 检查 bool 变量是 1/true 还是 0/false?

我是TinyButStrong的新手,我想知道如何检查bool变量是0还是1?例如,我有这个:$TBS->MergeBlock('tests',$tests);$tests有一个bool值变量call'activated'。因此,在我的.docx文档中,如果变量设置为true(1),我想写字符串“Activated”,如果变量设置为false(0),我想写“non-activated”。我应该在.docx文档中使用哪种语法?提前致谢。 最佳答案 在合并过程中有几种格式化值的方法,但默认情况下TBS使用PHP隐式转换将数据项转换为字符

PHP cURL 在 HTTPS 上返回 FALSE

我正在尝试制作一个机器人:https://coinroll.it/api来自网站:CoinrollAPI是一个通过HTTPS工作的无状态接口(interface)。请求是使用POST变量(application/x-www-form-urlencoded)发出的,而响应是用JSON(application/json)编码的。访问API需要HTTPS连接。我有以下代码:$ch=curl_init();$data=array('user'=>'xxx','password'=>'yyy');curl_setopt($ch,CURLOPT_URL,'https://coinroll.it')

php - 奏鸣曲管理员 - sonata_type_collection : select from the list of existing entities

我正在尝试使用PageHasImage桥接实体在Page和Image实体之间实现多对多关系。在PageAdmin中,我添加了如下字段:->add('galleryImages','sonata_type_collection',array('cascade_validation'=>false,'by_reference'=>false,'type_options'=>array('delete'=>false)),array('edit'=>'inline','inline'=>'table','sortable'=>'position','admin_code'=>'sonata.

php - 压缩存档 PHP : Close() returns false with no error message

我正在尝试使用基于数组结构的目录树创建一个zip文件。我已经在使用thisanswer当我需要从目录树创建一个zip文件时,但在这种情况下,所有文件都在同一目录中,目录树基于数据库中的其他数据。我已经检查过所有文件都在正确的路径中,并且foreach循环正在运行。$zip->close发生错误。这就是代码(原始数组在每一层都有很多条目):$zip_array=array('Level1'=>array('Level2'=>array('file1'=>'/var/www/html/pdf/683026577.pdf','file2'=>'/var/www/html/pdf/683026

PHP7 : Methods with a scalar type declaration refuse to type juggle NULL values, 即使在弱/强制模式下

截至PHP7.0,标量类型提示int、float、string和bool可以包含在方法签名中。默认情况下,这些类型声明以弱/强制模式(或“typejuggling”模式)运行。根据PHPmanual:PHPwillcoercevaluesofthewrongtypeintotheexpectedscalartypeifpossible.Forexample,afunctionthatisgivenanintegerforaparameterthatexpectsastringwillgetavariableoftypestring.但即使可以将NULL强制转换为整数0,具有int类型提

php - 在从源代码编译的 PHP 7.1 上安装 SPL_Types

我正在尝试在从源代码编译的PHP7.1.8中安装SPL_Types扩展。我尝试使用sudopeclinstallSPL_Types并从源代码编译扩展,但我得到以下输出:https://mega.nz/#!WE5WjajQ!QyVxMYWrsUiDF6Gq09psYBpR5Y336v26PusnlBNd8bg我知道发布链接并不酷,但我无法将空洞输出放在这里。 最佳答案 此扩展现已过时,无法使用PHP7.x构建。此库的最新版本released2012年,仅支持PHP5.4。native标量类型声明支持使此扩展几乎无用(可能除了SplEn

php - "Type error: Too few arguments to function App\Http\Controllers\UserController::attendance(), 0 passed and exactly 1 expected"

我的数据库中有两个表,分别是用户表和出勤表。我现在想做的是根据用户在与他们的个人资料相关联的出勤View中显示数据库中的出勤数据。这是我在userController中的考勤功能。publicfunctionattendance($id){$user=UserProfile::findOrFail($id);$this->authorize('modifyUser',$user);returnview('user.attendance',['user'=>$user]);}这是我到出勤View的路径。Route::get('/attendance/',['as'=>'user.atte

php - 安装时没有引号的 eav_entity_type

起源...我有一个带有设置脚本的模块(常见的mysql4-upgrade-0.1.0-0.1.1.php),添加一个属性来引用:$eav=newMage_Eav_Model_Entity_Setup('sales_setup');$eav->addAttribute('quote','my_attribute',array('type'=>'varchar'));如果我在空数据库上运行我的magento商店,设置脚本会运行,并且“错误的实体ID”错误会中断该过程。调用堆栈指向我的设置脚本。...寻找...如果我转到数据库,我会看到eav_entity_type表已填充但只有8种类型:报

php - headers_sent() 返回 false,但 header 已发送

我的代码很简单:...它返回错误。打印完东西后不应该立即发送标题吗?就像在第一个之后性格。 最佳答案 这取决于php.ini文件中的output_buffering指令。如果它是Offoutput_buffering=Off然后echoheaders_sent()应该输出1在其他情况下,headers_sent()不会输出任何结果,因为它将为FALSE。不会发送header,因为输出已缓冲。如果你想绕过这个并强制发送header,你可以使用flush().希望这对您有所帮助! 关于php

php - Laravel 的 Auth::attempt() 返回 true 但 Auth::check() 返回 false

如标题所示,Laravel的函数Auth::attempt()返回true如下代码部分(删除了不重要的部分):publicfunctiondoLogin(){$validator=[..]if($validator->fails()){[..]}else{$userdata=array('username'=>Input::get('username'),'password'=>Input::get('password'));if(Auth::attempt($userdata,true)){returnRedirect::to('/');}else{returnRedirect::t