PHP Program installation Error

Source: Internet
Author: User
Tags dsn blank page
Other people's website can display the verification code normally, I and he is the same program, I install the prompt "method does not exist."




if (!class_exists ($control)) NotFound (' Controller 1 ' not found);
$JMS =new $control ($conf [' db '] [' DSN '], $conf [' db '] [' user '], $conf [' db '] [' password ']);
$JMS->debuglevel= $conf [' Debug '] [' level '];

if (!method_exists ($JMS, $action)) NotFound (' Method not present ');
$reflection =new Reflectionmethod ($JMS, $action);
if ($reflection->isstatic ()) NotFound (' method not allowed to invoke the static modifier ');
if (! $reflection->isfinal ()) NotFound (' Can only invoke the final modified method ');

Http://vip4.zrd-w.com This is someone else's website

Since it is the same program, the database connection is also correct, I estimate may not be the problem of the program, but I do not understand PHP, and do not know if this is the reason?

Here's the whole code.

Require ' 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 (' Controller not found ');
try{
Require $file;
}catch (Exception $e) {
Print_r ($e);
Exit
}

if (!class_exists ($control)) NotFound (' Controller 1 ' not found);
$JMS =new $control ($conf [' db '] [' DSN '], $conf [' db '] [' user '], $conf [' db '] [' password ']);
$JMS->debuglevel= $conf [' Debug '] [' level '];

if (!method_exists ($JMS, $action)) NotFound (' Method not present ');
$reflection =new Reflectionmethod ($JMS, $action);
if ($reflection->isstatic ()) NotFound (' method not allowed to invoke the static modifier ');
if (! $reflection->isfinal ()) NotFound (' Can only invoke the final modified method ');

$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 ')) {
Function 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 ')) {

Table Monotone use
$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 calls
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{
General request
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);
}
Ask the master to help solve the next, thank you.


Reply to discussion (solution)

 debuglevel= $conf [' Debug '] [' Level '];if (!method_exists ($JMS, $action)) NotFound (' Method not present '); $reflection =new Reflectionmethod ($JMS, $action), if ($reflection->isstatic ()) NotFound (' method not allowed to invoke static adornments '); if (! $reflection IsFinal ()) NotFound (' Can only invoke the final modified method '); $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 '])) {// Function 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 ')) {//table monotonic with $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 call 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{//General request 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

 
  

You put
if (!method_exists ($JMS, $action)) NotFound (' Method not present ');
Change into
if (!method_exists ($JMS, $action)) NotFound ("$JMS:: $action method does not exist");
Run and see.

You put
if (!method_exists ($JMS, $action)) NotFound (' Method not present ');
Change into
if (!method_exists ($JMS, $action)) NotFound ("$JMS:: $action method does not exist");
Run and see.


Blank page.



if (!method_exists ($JMS, $action)) NotFound (' Method not present ');
Change into
if (!method_exists ($JMS, $action)) NotFound ("$action method does not exist");
Run again

It's obviously a little copy of the file or the wrong location.

Should not be less files Ah, is the whole package down,
I'm on the net, help me see it. What's less? Thank you, sir.
Http://yun.baidu.com/s/1eQxelqE

Solve it yourself.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.