php-php using arrays to invoke methods in class, an error occurred

Source: Internet
Author: User
Tags stack trace
Php

/**

  • Enable Session/session_start ();
  • Contains initialization file /include_once '. /.. /.. /sys/config/db-cred.inc.php ';/*
  • Define constants for configuration information /foreach ($C as $name = = $val) {define ($name, $val);} /*
  • Generate an associative array with the form action key
    */
    $actions = Array (
    ' Event_edit ' = Array (
    ' Object ' = ' Calendar ',
    ' Method ' = ' processform ',
    ' Header ' = ' location: '. /.. /'
    ),

    ' User_login ' = Array (
    ' Object ' = ' Admin ',
    ' Method ' = ' processloginform ',
    ' Header ' = ' location: '. /.. /'
    )
    );
    /**

  • Ensure that the anti-cross-site mark in the session is consistent with the submitted tag and the request is valid.
    */
    if ($_post[' token ']==$_session[' token ') &&
    Isset ($actions [$_post[' action '])) {
    $use _array = $actions [$_post[' action '];
    $obj = new $use _array ' object ';

    if ( true == $msg=$obj->$use_array['method']() ) {    header($use_array['header']);    exit;} else {    die( $msg );}

    } else {
    Redirect to Home page if token/action is illegal
    Header ("Location:.. /.. /");
    Exit
    }

function __autoload ($class) {

$filename = "../../../sys/class/class.".$class.".inc.php";if ( file_exists($filename) ) {    include_once $filename;}

}

The main problem is this: $obj-$use _array ' method '
As soon as this step comes up, function name must is a string in E:\qampp\htdocs\Source files\public\assets\inc\process.inc.php:40 Stack Trace: #0 {main} thrown in E:\qampp\htdocs\Source files\public\assets\inc\process.inc.php on the line 40 error.

It is possible to call the ProcessForm () or Processloginform () method in the class directly with $obj.
Ask the great God to help see.

Reply content:

Http://blog.sina.com.cn/s/blog_8d7518cb0100zk1t.html

  • 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.