ホームページ  >  記事  >  バックエンド開発  >  PHPプログラムのインストールエラー

PHPプログラムのインストールエラー

WBOY
WBOYオリジナル
2016-06-23 13:58:411438ブラウズ

他の人のウェブサイトでは正常に認証コードが表示されますが、私も彼と同じプログラムをインストールしましたが、[メソッドが存在しません] と表示されました。




if(!class_exists($control)) notfound('コントローラー 1 が見つかりません');
$jms=new $control($conf['db']['dsn'], $conf[ 'db ']['ユーザー'], $conf['db']['パスワード']);
$jms->debugLevel=$conf['デバッグ']['レベル'];

if(! $jms, $action)) notfound('メソッドが存在しません');
$reflection=new ReflectionMethod($jms, $action);
if($reflection->isStatic()) notfound('呼び出しは許可されていません変更されたメソッド');
if(!$reflection->isFinal()) notfound('最終的に変更されたメソッドのみを呼び出すことができます');

http://vip4.zrd-w.com これは他の人の Web サイトです

同じプログラムでデータベース接続も正しいので、プログラムの問題ではないのかもしれませんが、PHPは全く分からないので、これが原因なのか分かりません?

以下は完全なコードです。

19e1b94aec04a4ba063e594db29d5099debugLevel=$conf['デバッグ']['レベル']

if (!method_exists( $jms, $action)) notfound('メソッドが存在しません');
$reflection=new ReflectionMethod($jms, $action)) notfound('静的ではない変更されたメソッドの呼び出しが許可されています');
if(!$reflection->isFinal()) notfound('最終的に変更されたメソッドのみを呼び出すことができます');
$jms->controller=$control; >action=$action;

$jms->charset=$conf['db']['charset']
$jms->cacheDir=$conf['cache']['dir'] ;
$jms->setCacheDir($conf['cache']['dir']);
$jms->actionTemplate=$conf['action']['template'];
$jms-> =$conf['db']['prename'];
$jms->title=$conf['web']['title'];
if(method_exists($jms, 'getSystemSettings')) $ jms ->getSystemSettings();

//if($jms->settings['switchWeb']=='0'){
// $jms->display('close-service.php') ;
// 終了
//}

if(isset($page)) $jms->page=$page;

if($q=$_SERVER['QUERY_STRING']){
$para= array_merge ($para,explode('/', $q));
}

if($para==null) $para=array();

$jms->headers=getallheaders(); isset($jms->headers['x-call'])){
// 関数呼び出し
header('content-Type: application/json');
try{
ob_start();リフレクション->invokeArgs($jms, $_POST));
ob_flush()
}catch(Exception $e){
$jms->error($e->getMessage(), true);
}elseif(isset($jms->headers['x-form-call'])){

// フォーム呼び出し
$accept=strpos($jms->headers['Accept'], ' application /json')===0;
if($accept) header('content-Type: application/json');
try{
ob_start(){
echo json_encode($reflection -) >invokeArgs($jms, $_POST));
}else{
json_encode($reflection->invokeArgs($jms, $_POST));
}
ob_flush()
}catch(Exception $e);
$jms->error($e->getMessage(), true);
}
}elseif(strpos($jms->headers['Accept'], 'application/json')=== 0 ){
// AJAX 呼び出し
header('content-Type: application/json');
try{

//echo json_encode($reflection->invokeArgs($jms, $para));
echo json_encode(call_user_func_array(array($jms, $para)) action), $para));
}catch(Exception $e){
$jms->error($e->getmessage());
}
}else{
// 通常のリクエスト
header(' content-Type: text/html;charset=utf-8');
//$reflection->invokeArgs($jms, $para);
call_user_func_array(array($jms, $action), $para); }
$jms=null;

function notfound($message){
header('content-Type: text/plain; charset=utf8');
header('HTTP/1.1 404 Not Found'); $message);
}
この問題の解決を手伝ってください、ありがとう。

ディスカッションへの返信 (解決策)

<?phprequire 'lib/core/DBAccess.class';require 'lib/core/Object.class';require 'action/default/WebBase.class.php';require 'action/default/WebLoginBase.class.php';require 'config.php';//print_r($_SERVER);exit;$para=array();if(isset($_SERVER['PATH_INFO'])){	$para=explode('/', substr($_SERVER['PATH_INFO'],1));	if($control=array_shift($para)){		if(count($para)){			$action=array_shift($para);		}else{			$action=$control;			$control='index';		}	}else{		$control='index';		$action='main';	}}else{	$control='index';	$action='main';}$control=ucfirst($control);if(strpos($action,'-')!==false){	list($action, $page)=explode('-',$action);}$file=$conf['action']['modals'].$control.'.class.php';if(!is_file($file)) notfound('找不到控制器');try{	require $file;}catch(Exception $e){	print_r($e);	exit;}if(!class_exists($control)) notfound('找不到控制器1');$jms=new $control($conf['db']['dsn'], $conf['db']['user'], $conf['db']['password']);$jms->debugLevel=$conf['debug']['level'];if(!method_exists($jms, $action)) notfound('方法不存在');$reflection=new ReflectionMethod($jms, $action);if($reflection->isStatic()) notfound('不允许调用Static修饰的方法');if(!$reflection->isFinal()) notfound('只能调用final修饰的方法');$jms->controller=$control;$jms->action=$action;$jms->charset=$conf['db']['charset'];$jms->cacheDir=$conf['cache']['dir'];$jms->setCacheDir($conf['cache']['dir']);$jms->actionTemplate=$conf['action']['template'];$jms->prename=$conf['db']['prename'];$jms->title=$conf['web']['title'];if(method_exists($jms, 'getSystemSettings')) $jms->getSystemSettings();//if($jms->settings['switchWeb']=='0'){//	$jms->display('close-service.php');//	exit;//}if(isset($page)) $jms->page=$page;if($q=$_SERVER['QUERY_STRING']){	$para=array_merge($para, explode('/', $q));}if($para==null) $para=array();$jms->headers=getallheaders();if(isset($jms->headers['x-call'])){	// 函数调用	header('content-Type: application/json');	try{		ob_start();		echo json_encode($reflection->invokeArgs($jms, $_POST));		ob_flush();	}catch(Exception $e){		$jms->error($e->getMessage(), true);	}}elseif(isset($jms->headers['x-form-call'])){	// 表单调用	$accept=strpos($jms->headers['Accept'], 'application/json')===0;	if($accept) header('content-Type: application/json');	try{		ob_start();		if($accept){			echo json_encode($reflection->invokeArgs($jms, $_POST));		}else{			json_encode($reflection->invokeArgs($jms, $_POST));		}		ob_flush();	}catch(Exception $e){		$jms->error($e->getMessage(), true);	}}elseif(strpos($jms->headers['Accept'], 'application/json')===0){	// AJAX调用	header('content-Type: application/json');	try{				//echo json_encode($reflection->invokeArgs($jms, $para));		echo json_encode(call_user_func_array(array($jms, $action), $para));	}catch(Exception $e){		$jms->error($e->getmessage());	}}else{	// 普通请求	header('content-Type: text/html;charset=utf-8');	//$reflection->invokeArgs($jms, $para);	call_user_func_array(array($jms, $action), $para);}$jms=null;function notfound($message){	header('content-Type: text/plain; charset=utf8');	header('HTTP/1.1 404 Not Found');	die($message);}

config.php

<?php$conf['debug']['level']=5;$conf['db']['dsn']='mysql:host=localhost;dbname=kelake';$conf['db']['user']='root';$conf['db']['password']='123456';$conf['db']['charset']='utf8';$conf['db']['prename']='ssc_';$conf['cache']['expire']=0;$conf['cache']['dir']='_cache/';$conf['url_modal']=2;$conf['action']['template']='inc/default/';$conf['action']['modals']='action/default/';$conf['member']['sessionTime']=15*60;error_reporting(E_ERROR &~E_NOTICE);ini_set('date.timezone','asia/shanghai');?>


if(!method_exists($jms, $action)) notfound('メソッドが存在しません') を

に変更します。
if(!method_exists($jms, $action)) notfound("$jms::$action メソッドが存在しません");
もう一度実行して確認してください

if(!method_exists($jms, $ action) ) notfound('メソッドが存在しません');

if(!method_exists($jms, $action)) notfound("$jms::$action メソッドが存在しません"); に変更します

もう一度実行して確認します

空白のページ。


if(!method_exists($jms, $action)) notfound('メソッドが存在しません');
に変更します
if(!method_exists($jms, $action)) notfound("$action メソッド存在しない" ;何が足りないのでしょうか?ありがとう。
http://yun.baidu.com/s/1eQxelqE


自分で解決しました。
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。