The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.More information about this error may be available in the server error log.Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
<?php namespace Phpcmf\Controllers;
class Go extends \Phpcmf\Common
{
public function index() {
echo file_get_content(SITE_URL.'go.php?id='.intval($_GET['id']));exit;
}
}
官方研发实习技术
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/go/([0-9]+)$ /go.php?id=$1 RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /index.php [NC,L]Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.More information about this error may be available in the server error log.Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.Internal Server Error
这个错误表示。htaccess里面的内容写错了Internal Server Error
RewriteEngine On RewriteBase / RewriteRule ^go\/([0-9]+)\/$ /go.php?id=$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /index.php [NC,L]试一试这种<?php namespace Phpcmf\Controllers; class Go extends \Phpcmf\Common { public function index() { echo file_get_content(SITE_URL.'go.php?id='.intval($_GET['id']));exit; } }<?php /** * 自定义程序 */ define('IS_API', basename(__FILE__, '.php')); // 项目标识 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); // 该文件的名称 require((dirname(__FILE__)).'/index.php'); // 引入主文件页面二:\dayrui\My\Api\go.php<?php /** * 自定义程序的控制器代码 这里写php代码,基于控制器类 */ $id = intval($_GET['id']); $data = \Phpcmf\Service::M()->table_site("sp")->get($id); // 这里吧demo改成你的模块目录名称 $url = $data['sptklj']; // 输出url看看对不对,这里可以改进为301跳转等等,自由发挥 ?>有了上面两个页面,可以正常访问:http://localhost:81/go.php?id=760然后试了上面大家热心的建议,还是不能实现伪静态http://localhost:81/go/760 访问rewrite.php 规则已经试过如下:也都不行<?php namespace Phpcmf\Controllers; class Go extends \Phpcmf\Common { public function index() { /** * 自定义程序的控制器代码 这里写php代码,基于控制器类 */ $id = intval($_GET['id']); $data = \Phpcmf\Service::M()->table_site("sp")->get($id); // 这里吧demo改成你的模块目录名称 $url = $data['sptklj']; // 输出url看看对不对,这里可以改进为301跳转等等,自由发挥 } }已增加 文件\dayrui\Core\Controllers\go.php"仍然报错 应用程序(go)不存在
2、 文件\dayrui\Core\Controllers\go.php 改成 Go.php,首字母大写
你这里没有写输出的文字,当然是一片白白色了
<?php namespace Phpcmf\Controllers; class Go extends \Phpcmf\Common { public function index() { /** * 自定义程序的控制器代码 这里写php代码,基于控制器类 */ $id = intval($_GET['id']); $data = \Phpcmf\Service::M()->table_site("sp")->get($id); // 这里吧demo改成你的模块目录名称 $url = $data['sptklj']; // 输出url看看对不对,这里可以改进为301跳转等等,自由发挥 } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head> <body> <?php echo $id;?> <?php echo $url;?> </body> </html>这样输出也是空白<?php namespace Phpcmf\Controllers; class Go extends \Phpcmf\Common { public function index() { /** * 自定义程序的控制器代码 这里写php代码,基于控制器类 */ $id = intval($_GET['id']); $data = \Phpcmf\Service::M()->table_site("sp")->get($id); // 这里吧demo改成你的模块目录名称 $url = $data['sptklj']; // 输出url看看对不对,这里可以改进为301跳转等等,自由发挥 echo ' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head> <body> '.$id.' - ----------- '.$url.' </body> </html>'; } } ?>\Phpcmf\Service::V()->display('go.html');http://help.xunruicms.com/206.html 手册有现成的,基础而已