php - 分页中遇到刀片 php 的格式不正确的数值
问题描述
我正在尝试在 php 分页中显示页面中显示的项目数。这是我的代码:
@if ($result->onFirstPage())
{{1 . '~' . $result->count()}}
@else
{{(($result->currentPage()-1)*12)+1 . '~' . + (($result->currentPage()-1)*12) + $result->count() }}
@endif
我已经尝试将它们类型转换为 int 但仍然无法正常工作。此计算(($result->currentPage()-1)*12)
效果很好,但如果我添加$result->count()
它会返回non well formed numeric value
错误。我怎么可能修复这个?关于如何解决这个问题的一些建议不起作用。
解决方案
好,知道了。我只是将它们括在一个括号中!
((($result->currentPage()-1)*12) + $result->count())
所以我的行将如下所示:
{{(($result->currentPage()-1)*12)+1 . '~' . + ((($result->currentPage()-1)*12) + $result->count()) }}
推荐阅读
- c - fgets 函数行为异常
- java - 将蛇案例转换为骆驼案例以进行 Spring 分页和排序
- java - 数组列表
使用 Jackson Object Mapper 打印时在列表中创建空数组 - javascript - 防止 iFrame 重定向到 src url 以外的 url
- django - 为什么 FieldDoesNotExist 在 POST.get() 上不起作用?
- javascript - Neo4j Rest API 身份验证
- azure - 如果特定容器文件夹未在 24 小时内更新,Azure Blob 容器警报
- openssl - 使用 keytool 导入私钥和公钥
- amazon-web-services - HIVE_CURSOR_ERROR:请降低您的请求率
- photoshop - Photoshop 图层不显示