PHPCMS load System class and load application class The difference between the detailed

Source: Internet
Author: User

<?php


1. Loading System class methods
Load_sys_class ($classname, $path = "", $initialize = 1)
The file path where the system class file is located: under the/phpcms/libs/classes/folder
Parameter description:
@param string $classname class name
@param string $path Extension address
@param Intger $initialize is initialized

Example: To call the System form class to generate the CAPTCHA function: Checkcode (), see the following example
Pc_base::load_sys_class (' form ', ', 0); Load System Form Class
echo form::checkcode (' code_img ', ' 4 ', ' 14 ', 84, 24); Calling a function within a system form
The results show that the resulting verification code, such as
One of the PHPCMS development Notes <wbr><wbr> Load system class and load application class The difference between the detailed

2. Load the Application class method
Load_app_class ($classname, $m = "", $initialize = 1)

File path where the application class file resides: Under the/phpcms/modules/member/classes/folder (for Member Application module Class description path)

Parameter description:
@param string $classname class name
@param string $m Module
@param Intger $initialize is initialized

Example: Example of a client class that introduces a member application module
Pc_base::load_app_class (' client ', ' member '); Load Member Application Module client class
$phpsso _api_url = pc_base::load_config (' System ', ' Phpsso_api_url ');
$phpsso _auth_key = pc_base::load_config (' System ', ' Phpsso_auth_key ');
$client = new Client ($phpsso _api_url, $phpsso _auth_key); Creating objects
$username = ' phpcms ';
$pasword = ' 123456 ';
$client->ps_member_login ($username, $password); Calling the login function

Note: If the application class is loaded across modules, do not forget the parameter $m, otherwise the application class will not be loaded.






?>

PHPCMS load System class and load application class The difference between the detailed

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.