您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇文章给大家介绍TP5相关解决问题有哪些,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
- command.php 命令行启动TP5框架需要读取的文件 - common.php 常用的函数,都写在这个文件中 - config.php 配置文件,开启什么,关闭什么,都在这设置 - database.php 连接数据库时候读取的文件,比如用户名 - route.php 路由文件,美化url的 - tags.php 扩展框架的时候用到
- static 这里放的是css、html之类的静态文件 - favicon.ico 这个是网站图标,在标签栏显示的 - index.php 网站入口文件,所有的请求都会经过这里 - robots.txt 禁止搜索引擎爬取页面的设置 - router.php 在没有部署网站环境的情况下,配置这个文件可以让网站运行
- 目录 只是小写字母和下划线构成 - 类的文件名以命名空间定义,并且命名空间和类库文件所在路径一致。 - 类的文件采用驼峰,并且首字母大写,其余文件为小写加下划线。 - 类名和类文件名保持一致,采用驼峰命名,首字母大写。 - 函数使用驼峰命名,首字母小写。 - 属性名采用驼峰,首字母小写 - 以双下划线开头的函数或方法为魔术方法。 - 常量以大写字母和下划线命名 - 表和字段必须以小写字母和下划线命名方式,不能以下划线开头。
修改vhosts.conf
<VirtualHost _default_:80> DocumentRoot "C:\phpStudy\PHPTutorial\WWW\public" ServerName localhost ServerAlias localhost <Directory "C:\phpStudy\PHPTutorial\WWW\public"> #下面被注释的代码,用“localhost”访问时会禁止访问 #Options -Indexes -FollowSymLinks +ExecCGI Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "C:\phpStudy\PHPTutorial\WWW\public" ServerName www.gohosts.com ServerAlias gohosts.com <Directory "C:\phpStudy\PHPTutorial\WWW\public"> Options FollowSymLinks ExecCGI AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>
httpd.conf
去掉LoadModule rewrite_module前面的#
AllowOverride None 替换为 AllowOverride All(有多处设置,需要替换)然后保存
在相应的目录下,添加.htacces文件
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>添加web.config文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="cms">
<match url="^cms/(.*)$" />
<action type="Rewrite" url="/public/cms/pages/{R:1}" />
</rule>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/public/index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>关于TP5相关解决问题有哪些就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。