Php program installation error

Source: Internet
Author: User
Tags blank page
Php program installation error someone else's website can display the verification code normally. I am using the same program as him. after installation, I prompt [method does not exist ].




If (! Class_exists ($ control) notfound ('unable to find controller 1 ');
$ Jms = new $ control ($ conf ['DB'] ['dsn '], $ conf ['DB'] ['user'], $ conf ['DB'] ['password']);
$ Jms-> debugLevel = $ conf ['debug'] ['level'];

If (! Method_exists ($ jms, $ action) notfound ('method does not exist ');
$ Reflection = new ReflectionMethod ($ jms, $ action );
If ($ reflection-> isStatic () notfound ('Do not allow calling the Static modifier method ');
If (! $ Reflection-> isFinal () notfound ('only methods modified by final' can be called ');

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

Since it is the same program and the database connection is correct, I guess it may not be a problem with the program, but I don't know anything about PHP, and I don't know why?

The following is all the 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 ('unable to find the controller ');
Try {
Require $ file;
} Catch (Exception $ e ){
Print_r ($ e );
Exit;
}

If (! Class_exists ($ control) notfound ('unable to find controller 1 ');
$ Jms = new $ control ($ conf ['DB'] ['dsn '], $ conf ['DB'] ['user'], $ conf ['DB'] ['password']);
$ Jms-> debugLevel = $ conf ['debug'] ['level'];

If (! Method_exists ($ jms, $ action) notfound ('method does not exist ');
$ Reflection = new ReflectionMethod ($ jms, $ action );
If ($ reflection-> isStatic () notfound ('Do not allow calling the Static modifier method ');
If (! $ Reflection-> isFinal () notfound ('only methods modified by final' can be called ');

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

// Form call
$ Accept = strpos ($ jms-> headers ['access'], '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 ['access'], '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 {
// Common 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 );
}
Thank you for your help.


Reply to discussion (solution)

 DebugLevel = $ conf ['debug'] ['level']; if (! Method_exists ($ jms, $ action) notfound ('method does not exist'); $ reflection = new ReflectionMethod ($ jms, $ action); if ($ reflection-> isStatic ()) notfound ('Do not allow calling Static modifier method'); if (! $ Reflection-> isFinal () notfound ('method that can only call final modify'); $ 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']) {// 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 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 {// normal 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 does not exist ');
Change
If (! Method_exists ($ jms, $ action) notfound ("$ jms ::$ action method does not exist ");
Run it again.

You put
If (! Method_exists ($ jms, $ action) notfound ('method does not exist ');
Change
If (! Method_exists ($ jms, $ action) notfound ("$ jms ::$ action method does not exist ");
Run it again.


Blank page.



If (! Method_exists ($ jms, $ action) notfound ('method does not exist ');
Change
If (! Method_exists ($ jms, $ action) notfound ("$ action method does not exist ");
Run Again

Apparently, the file or location is not copied.

There should be no fewer files. the whole package is made,
I uploaded the online storage. Please check it out for me. What's missing? Thank you.
Http://yun.baidu.com/s/1eQxelqE

Solved by 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.