thinkphp5.1问题发现与解决
2022-07-28 14:14:58
105
{{single.collect_count}}

问题描述:

新下载的thinkphp5.1,在第一次配置好环境期待看到欢迎界面的时候,神奇的报错了

报错信息

Parse error: syntax error, unexpected ‘class’ (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or ‘{’ or ‘$’ in F:\mygit\company\thinkphp\base.php on line 33

解决方案

emmmm,没错,是因为我版本选择的太低了,最少需要php 5.6以上的版本


问题描述

出现no input file specified的问题:通过composer安装tp5.1.35,在本地运行可以显示出默认首页,但是访问新写一个控制器方法例如:zykyw.com/index/test的时候,页面便会出现no input file specified

解决方案

因为伪静态的问题,只需要将/public/.htaccess文件内容修改如下

<IfModule mod_rewrite.c>Options +FollowSymlinks -MultiviewsRewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f#RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] //注释掉该行 RewriteRule ^(.*)$ index.php// 新增该行</IfModule> 
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}