Thinkphp6的URL访问模式
2022-11-24 11:10:29
212
{{single.collect_count}}

URL解析

  • tp框架中很多操作都是通过url实现的
  • 多应用:http://severName/index.php/应用/控制器/操作/参数/值…;
  • 单应用:http://serverName/index.php/控制器/操作/参数/值…;
  • tp6默认为单应用模式
  • http://serverName是域名地址,比如:127.0.0.1或localhost
  • 例如完整形式为:http://localhost/tp6/public/index.php/test/hello
  • public/index.php中的index.php可以使省略,只要设置url重写即可
  • 那么此时的完整路径为:http://localhost/tp6/public/test/hello

URL兼容模式

  • 如果以上的那种形式的URL不支持,可以使用兼容模式
  • 例如:http://tp6/public/?s=test/hello
回帖
全部回帖({{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 ? '加载中...' : '查看更多评论'}}