一、环境
Discuz 3.4
二、故障现象
Discuz手机版不能显示用户头像,如下图所示:
但是电脑版可以正常显示用户的头像。
三、解决方法
查看Discuz的报错日志(web服务器的错误日志),发现以下报错信息:
[Fri Aug 23 09:42:34.026657 2019] [:error] [pid 13876] [client xxxxxx ] PHP Parse error: syntax error, unexpected ':', expecting ',' or ')' in /var/www/html/upload/uc_server/avatar.php on line 14, referer: https://www.51anidea.com/forum.p ... lay&fid=75&mobile=2
检查 /var/www/html/upload/uc_server/avatar.php 文件(/var/www/html/upload是网站目录)的第14行,第14行内容如下:
define('UC_API', strtolower(($_SERVER[‘SERVER_PORT’] == 443 || $_SERVER[‘HTTPS’] == ‘on’ ? ‘https’ : ‘http’).’://’.$_SERVER[‘HTTP_HOST’].substr($_SERVER[‘PHP_SELF’], 0, str rpos($_SERVER[‘PHP_SELF’], '/'))));
把第14行改成如下内容(改之前记得先备份文件):
define('UC_API', strtolower('https'.'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
故障解决。
Discuz相关教程,参考以下链接:
https://www.51anidea.com/forum.php?mod=forumdisplay&fid=2