php - Wordpress PHP 警告:遇到非数字值
问题描述
一段时间以来,我一直收到以下错误:
PHP Warning: A non-numeric value encountered in /home/user/public_html/wp-content/themes/mytheme/content-one.php on line 29
PHP Warning: A non-numeric value encountered in /home/user/public_html/wp-content/themes/mytheme/content-one.php on line 30
这些行是:
$minutes = floor($duration_in_seconds / 60);
$seconds = $duration_in_seconds % 60;
PHP版本:7.3.20
谁能帮我一些建议,如何解决这个问题?谢谢!
解决方案
$duration_in_seconds
可能是一个字符串,修复它的简单方法是执行以下操作:
$duration_in_seconds = intval($duration_in_seconds, 10)
推荐阅读
- javascript - 当您将窗口向左或向右对齐时,是否会激活 Javascript 事件?
- python - 如何在 Python 中迭代二维数组
- python - 找到无穷大值并替换为 numpy 数组中每个向量的最大值
- c++ - c++函数中间的预处理器指令?
- javascript - 使用 Ajax 对产品进行排序
- matlab - Matlab中的内置数字类型列表
- canvas - 用字体渲染 vega 水平图表问题
- javascript - 在 React-Three-Fiber 中渲染索引缓冲区几何图形
- eclipse - Eclipse 项目 - 在链接资源中引用构建变量
- powershell - 如何在 PowerShell 中使用 NOT ONLY CONTAINS 操作