所以我对很多东西都很陌生。绝对是 PHP 和 idorm。我进行了广泛搜索,但我没有看到这个特定问题的答案。
ORM 类的对象无法转换为字符串。
Slim 错误在 $picture 的 php 代码中弹出。
这是在我的 HTML 视图中
<div class="profile-left">
<div class="profile-image">
<img src="<?= empty($picture) ? '/static/images/profile-default.png' : $picture ?>"/>
<i class="fa fa-user hide"></i>
</div>
<div class="m-b-10">
<button class="btn btn-warning btn-block btn-sm" type="button" id="change_picture" data-toggle="modal" href="#change-picture-modal">Change picture</button>
</div>
</div>
这是另一个文件中 $picture 的路径
$picture = ORM::for_table('picture')
->where('picture_gallery_id', $user->account_id)
->where('name', $user->account_id . ':profile')
->find_one();
$params = array_merge(
get_base_params('account', 'Edit Profile'),
[
'picture' => $picture,
]);
数据本身作为 bytea 保存在 Postgres 表中。
我很确定我在我的菜鸟风格中遗漏了一些东西。预先感谢您的任何帮助。