关于lnmp下搭thinkPHP无法找打指定静态页面(求答案)(急)
我在lnmp 下架了一个thinkPHP框架对应的小网站,非常奇怪,在环境都配置好后(配置文件里默认模块是Index,默认方法是index),我在url里输入localhost:10007/index.php/member/login,正常来说应该显示login.html,但是显示的是index.html的页面,只是样式都不对,查看源代码后发现样式路径是这样的,/index.php/index.php/member/index/Tpl/css/style.css,后来我config.php里的配置项改了如下:
'DEFAULT_MODULE'=>'Member', //设置默认的控制器名称
'DEFAULT_ACTION'=>'login', //设置默认的方法名称
又回无论url输入什么都总停留在login.html对应页,但是样式不对,产看原代码后发现样式路径是这样的,/index.php/index.php/index/index/Tpl/css/passport.min.css
总之,好像我的'DEFAULT_MODULE'和'DEFAULT_ACTION'配置项配置成什么,url无论输入什么都回显示与配置文件中默认的模块和方法对应的html文件
而且,应该也不是框架的问题,我从新下了个最新版本的thinkPHP,也不行,这次连index.html页面也显示不出来
我感觉就是我的那里配置不对,,但是又找不到!!!
主要的目录结构是这样:
App
index
Conf
config.php
Common
Lang
Runtime
Lib
Action
IndexAction.class.php
MemberAction.class.php
Tpl
default
Index
index.html
Member
login.html
js
css
images
ThinkPHP (ThinkPHP框架)
index.php
index.php内容如下
<?phpheader("content-type:text/html;charset=utf-8");// 定义ThinkPHP框架路径(相对于入口文件)define('THINK_PATH', './ThinkPHP'); //定义项目名称和路径define('APP_NAME', 'myapp');define('APP_PATH', './index');define('BACK_URL','./index.php');// 加载框架入口文件 require(THINK_PATH."/ThinkPHP.php");//实例化一个网站应用实例App::run();?>
config.php页面
<?phpreturn array( //'配置项'=>'配置值' 'DEFAULT_MODULE'=>'Index', //设置默认的控制器名称 'DEFAULT_ACTION'=>'index', //设置默认的方法名称 'APP_DEBUG'=>true, //开启调试模式 'TMPL_L_DELIM'=> '{{', // 模板引擎普通标签开始标记 'TMPL_R_DELIM'=> '}}', // 模板引擎普通标签结束标记 'URL_MODEL'=> 0, 'DB_NAME'=> 'Route', 'DB_PREFIX'=> 'p_', 'TMPL_ENGINE_TYPE'=>'Smarty', 'TOKEN_ON'=>false, 'TOKEN_NAME'=>'__hash__', 'TOKEN_TYPE'=>'md5', 'DB_FIELDTYPE_CHECK'=>false, 'TMPL_ENGINE_CONFIG'=>array( 'caching'=>false, 'template_dir'=>TMPL_PATH, 'compile_dir'=>CACHE_PATH, 'cache_dir'=>TEMP_PATH, 'left_delimiter'=>"{{", 'right_delimiter'=>"}}" ), 'TMPL_ACTION_ERROR' => TMPL_PATH.'default/Public/error.html', // 默认错误跳转对应的模板文件 'TMPL_ACTION_SUCCESS' => TMPL_PATH.'default/Public/success.html',);?>
IndexAction.class.php页面
<?php// 本文档自动生成,仅供测试运行class IndexAction extends Action{ /** +---------------------------------------------------------- * 探针模式 +---------------------------------------------------------- */ public function checkEnv() { load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数 $env_table = check_env();//根据当前函数获取当前环境 echo $env_table; } //重新定义的内容 public function index() { $this->display(); }}?>
MemberAction.class.php页面
<?phpclass MemberAction extends Action{ function login(){ $this->display(); }}
index.html 和 login.html 是内容不同的两个静态页面
回复讨论(解决方案)
原来是因为nginx下默认不支持thinkPHP的url的pathinfo 模式,,需要更改nginx的配置文件
apache和nginx是存在很多差?的,不可相同?之
如果?nginx缺少?解的?最好是?用,否?就像csdn一?常常出? 50x 的??
恩,Apache与Nginx之间有很多差异,比如说rewrite重写规则就有一定的差异...
如果有人也遇到同样问题,可以参考这个网址,,但我没成功,我不是完全按他的来的。。http://blog.fity.cn/post/416/
恩,,回头学习下nginx以后肯定会经常接触

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
