我在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以后肯定会经常接触

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version
SublimeText3 Linux latest version

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool