- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想显示特定日期最后插入行的字段 (bal)。
$BALdata171201 = ORM::for_table('sys_transactions')->where('date',$data171201)->select('bal')->order_by_desc('id')->limit(1)
但我不断收到错误:
可捕获的 fatal error :ORM 类的对象无法转换为字符串
如何在字符串中进行 ORM 对象转换?
我已经阅读了该问题的数十个答案,但没有找到任何解决方案。
如果我使用 var_dump 我得到:
object(IdiormResultSet)#132 (1) {
["_results":protected]=>
array(1) {
[0]=>
object(ORM)#131 (22) {
["_connection_name":protected]=>
string(7) "default"
["_table_name":protected]=>
string(16) "sys_transactions"
["_table_alias":protected]=>
NULL
["_values":protected]=>
array(0) {
}
["_result_columns":protected]=>
array(1) {
[0]=>
string(1) "*"
}
["_using_default_result_columns":protected]=>
bool(true)
["_join_sources":protected]=>
array(0) {
}
["_distinct":protected]=>
bool(false)
["_is_raw_query":protected]=>
bool(false)
["_raw_query":protected]=>
string(0) ""
["_raw_parameters":protected]=>
array(0) {
}
["_where_conditions":protected]=>
array(0) {
}
["_limit":protected]=>
NULL
["_offset":protected]=>
NULL
["_order_by":protected]=>
array(0) {
}
["_group_by":protected]=>
array(0) {
}
["_having_conditions":protected]=>
array(0) {
}
["_data":protected]=>
array(1) {
["bal"]=>
string(7) "1354.00"
}
["_dirty_fields":protected]=>
array(0) {
}
["_expr_fields":protected]=>
array(0) {
}
["_is_new":protected]=>
bool(false)
["_instance_id_column":protected]=>
NULL
}
}
}
我已经尝试过执行 $BALdata171201string = $BALdata171201string->_data;但我得到的是空 echo 。
最佳答案
我已经解决了我的问题。
在前端我使用以下方式调用:{$BALdata171201}
现在我正在使用:
{foreach $BALdata171201 as $b01s} <b>Balanço</b></br>R$ {$b01s['bal']}{/foreach}
并且工作起来很有魅力。
关于php - ORM 类的对象无法使用 Idiorm 转换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47702236/
我正在尝试让 Idiorm/Paris 与我的 PHP 项目一起工作。我的表对象位于名为项目的文件夹/命名空间中,当我尝试运行 Idiorm/Paris 时,它将“项目”名称添加到列中。 "Uncau
MySQL 语法 SELECT users.*, roles.name, departments.name FROM users INNER JOIN roles ON users.roleId =
我正在使用 Idiorm - 一个非常简单的 ORM。我正在尝试在单个查询中更新多行。 Idiorm 不支持这个,所以我只剩下 n 查询或 raw_query陈述。 我选择后者。 但是,我似乎无法让它
我想显示特定日期最后插入行的字段 (bal)。 $BALdata171201 = ORM::for_table('sys_transactions')->where('date',$data17120
我正在使用 Paris (它建立在 Idiorm 之上)。 我有以下模型类(受 documentation on github 启发的示例): belongs_to('User'); } }
我无法使用 php idiorm/paris 获取 has_many 查询的结果。遵循 paris site 中的示例帖子的 has_many 结果作为对象返回。 太好了,我可以运行对象并访问各个方法
我正在尝试使用 idiorm 从 mysql 数据库中获取最后 30 个条目。一个单元格仅包含存储的“/question”或“/info”,而在我的 php 页面中,这些行未显示。我只是回应这些条目。
我在我的 PHP 项目中使用 Idiorm 和 Paris。 我想向我的 mysql 数据库添加一些带有空值的条目。 例如: $openingtime->setBegin(null); $openin
我有更新记录的功能,但我不能失败并向我发送“行中缺少主键 ID 或为空”消息,我该如何解决? public static function update_child($data) { try
我使用 WAMP 在本地主机上运行 PHP 代码。问题是在我的本地主机上我收到 utf8 错误,例如“lán”。在实时服务器上,我得到了“lån”,就像怀疑的那样。 到目前为止我已经尝试过 将服务器和
我的数据库中有一个模型(php 类)和一个表。当我尝试在没有 where 子句的情况下 find_many 时,它会找到所有数据库条目。它为每个数据库条目创建一个模型。但是这些模型是空的并且没有分配数
我有一个基于 Paris 的模型及其相关的“帖子”表: class Post extends Model { public static $_table = 'posts'; publ
我使用 PHP 并使用名为 Idiorm 的 ORM 进行 SQL 调用. 请求可能如下所示: $person = ORM::for_table('person')->create(); $perso
我想用 idiorm & paris 数据库工具包 ( http://j4mie.github.io/idiormandparis/ ) 提出这个请求: SELECT mqtt_table.* FRO
我是一名优秀的程序员,十分优秀!