无意中发现一个问题,因为将一个留言改为未审核状态,这个留言是我回复过的,更改父留言后,出现以下错误代码 Warning: Trying to access array offset on value of type null in /www/wwwroot/blog.ziyege.com/usr/themes/HarmonyHues/core/function.php on line 420
Warning: Trying to access array offset on value of type null in /www/wwwroot/blog.ziyege.com/usr/themes/HarmonyHues/core/function.php on line 420
Warning: Trying to access array offset on value of type null in /www/wwwroot/blog.ziyege.com/usr/themes/HarmonyHues/core/function.php on line 420
后经询问Ai,暂时解决了问题
在 getCommentAt() 函数中,$arow 可能为 null 或 false(例如父评论不存在、未审核或数据库查询失败),但代码直接访问了 $arow['url'] 和 $arow['author'],导致 PHP 7.4+ 触发 “Trying to access array offset on value of type null” 警告。
今天首页下面的hello突然变得差不多和侧边栏一样宽,刷新CSS也没解决,后来用龙虾帮忙,如下:
CDN 缓存了页面 HTML(PHP 服务端渲染结果)
如果 CDN 首次缓存时访客是移动端,isMobile() 返回 true,侧边栏 HTML 不输出
CDN 把这个"无侧边栏版"缓存后发给所有用户(包括桌面端)
修改 index.php,把 .index-footer-widget 移到 .row 外面:
<?php $this->need('components/sidebar.php'); ?>
这样无论侧边栏是否渲染,底部模块都不受 Bootstrap 行内 flex 布局的影响,永远占满容器宽度。
这样修改了下倒是正常了,因为对代码不太懂,所以发上来让你看看
暂时没发现这种情况,检查一下自己修改的代码,看看是不是div标签闭合问题导致的,isMobile这个主要是让手机端不要执行侧边栏函数,提高一些速度(当然可能微乎其微)
因为导航页会随着页面向上滚动,所以,返回顶部按钮基本上就没有用了,建议改到页面底部,
视频在全屏播放时,是适应宽度,如果是竖屏视频,会看不全,,建议
video {
max-height: 100vh;
object-fit: contain;
}
已优化
我叒来了,,插入视频时,如果不添加图片地址,显示的默认图片是方的,建议增加如果不添加图片,就用 preload="metadata" 让浏览器自动抓取视频第一帧
好的,已优化
有个小问题,,插入视频时,如果是竖屏视频,PC端 高度超出一个屏幕,观看时很不方便,用html代码插入可以解决,但不如直接用主题的插入视频代码好用
好的,后面优化一下
无意中发现一个问题,因为将一个留言改为未审核状态,这个留言是我回复过的,更改父留言后,出现以下错误代码
Warning: Trying to access array offset on value of type null in /www/wwwroot/blog.ziyege.com/usr/themes/HarmonyHues/core/function.php on line 420
Warning: Trying to access array offset on value of type null in /www/wwwroot/blog.ziyege.com/usr/themes/HarmonyHues/core/function.php on line 420
Warning: Trying to access array offset on value of type null in /www/wwwroot/blog.ziyege.com/usr/themes/HarmonyHues/core/function.php on line 420
后经询问Ai,暂时解决了问题
在 getCommentAt() 函数中,$arow 可能为 null 或 false(例如父评论不存在、未审核或数据库查询失败),但代码直接访问了 $arow['url'] 和 $arow['author'],导致 PHP 7.4+ 触发 “Trying to access array offset on value of type null” 警告。
该错误仅在评论带有 @回复 且父评论数据异常时触发,不影响正常浏览。
修复后,若父评论缺失或未审核,将不再输出 @作者 部分,避免页面报错。
建议同时更新主题其他潜在未判空的位置(如 $socialArray 遍历、$cnavbarArray 遍历等),但当前错误仅由 getCommentAt 引起。
好,感谢反馈,后面优化一下