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;
}
}
可以,這個只能寫在服務(wù)器的偽靜態(tài)配置里面去了,說說你的服務(wù)器是什么,每一個服務(wù)器配置不一樣
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)@官方研發(fā)實習(xí)技術(shù)
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
謝謝,麻煩您看下下面錯在哪里?
在.htaccess 這樣寫
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /index.php [NC,L]
RewriteRule ^/go/([0-9]+)$ /go.php?id=$1
在rewrite.php這樣寫
"go\/([0-9]+)" => "go.php?id=$1", //【獨(dú)立模塊測試規(guī)則】模塊內(nèi)容頁
// 獨(dú)立模塊測試規(guī)則---解析規(guī)則----結(jié)
訪問http://localhost:81/go/760還是報錯了
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]沒有放對地方
回復(fù)@奮斗的犀牛 加在這個位置,全站報錯了
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里面的內(nèi)容寫錯了
回復(fù)@黑蘋果 這個加上去還是報一樣的錯
Internal Server Error
回復(fù)@ibuc2t
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]
這樣寫,還是一樣報錯
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]試一試這種
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)@官方研發(fā)實習(xí)技術(shù) 這樣子不報錯了,但是無效果
htaccess文件不要改了,我也運(yùn)行不出來
改config/rewrite.php
新建

<?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; } }開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)@官方研發(fā)實習(xí)技術(shù)
還是不行,我把GO相關(guān)的頁面放出來共您參考
頁面一:
/go.php
<?php /** * 自定義程序 */ define('IS_API', basename(__FILE__, '.php')); // 項目標(biāo)識 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看看對不對,這里可以改進(jìn)為301跳轉(zhuǎn)等等,自由發(fā)揮 ?>有了上面兩個頁面,
可以正常訪問:
http://localhost:81/go.php?id=760
然后試了上面大家熱心的建議,還是不能實現(xiàn)偽靜態(tài)
http://localhost:81/go/760 訪問
rewrite.php 規(guī)則已經(jīng)試過如下:
也都不行
改config/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看看對不對,這里可以改進(jìn)為301跳轉(zhuǎn)等等,自由發(fā)揮 } }開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
補(bǔ)充上面
http://localhost:81/go/760
訪問提示如下:
新建控制器做偽靜態(tài)就行了,官方的方案最佳
回復(fù)@官方研發(fā)實習(xí)技術(shù)
已增加規(guī)則
已增加 文件\dayrui\Core\Controllers\go.php"
仍然報錯 應(yīng)用程序(go)不存在
你這個是銘文規(guī)則需要寫在最前面
1、規(guī)則寫前面,
2、 文件\dayrui\Core\Controllers\go.php 改成 Go.php,首字母大寫
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
老用戶告訴你,二次開發(fā)一定不要改系統(tǒng)的文件
回復(fù)@官方研發(fā)實習(xí)技術(shù)
現(xiàn)在不報錯了,但是http://localhost:81/go/760網(wǎng)頁是空白的,是不是因為RUL里面沒有ID了,頁面get不到id?
回復(fù)@成繼 沒有改過系統(tǒng)問題,都是新增的自定義入口程序
你這里沒有寫輸出的文字,當(dāng)然是一片白白色了
回復(fù)@心愿未了
<?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看看對不對,這里可以改進(jìn)為301跳轉(zhuǎn)等等,自由發(fā)揮 } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head> <body> <?php echo $id;?> <?php echo $url;?> </body> </html>這樣輸出也是空白
你不會php嗎,怎么可以這樣寫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看看對不對,這里可以改進(jìn)為301跳轉(zhuǎn)等等,自由發(fā)揮 echo ' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head> <body> '.$id.' - ----------- '.$url.' </body> </html>'; } } ?>回復(fù)@易學(xué)習(xí)
真不會PHP,只會html,謝謝
感謝各位大神的熱心、耐心解答
謝謝
回復(fù)@易學(xué)習(xí) 請問要給這個頁面能否指定模板名稱為go.html,要怎樣寫呢?
\Phpcmf\Service::V()->display('go.html');http://help.xunruicms.com/206.html 手冊有現(xiàn)成的,基礎(chǔ)而已