CrossPHP1.5.5 released, lightweight PHP development framework ~

Source: Internet
Author: User
CrossPHP1.5.5 released, lightweight PHP development framework ~ 1.5.5 update description 1. enhanced annotation configuration
  1. @ Cp_params all types of url styles take effect

  2. Enhanced @ cp_cache. you can inject anonymous function containers into the entry file to change the behavior.

    $app = Cross\Delegate::loadApp('web');$app->on('cpCache', function(&$cache_config) {    $cache_config['key'] = 'abc';    return true;});$app->run();

    In this case, the return value of the anonymous function is used as the switch to determine whether the request cache is effective.

  3. @ Cp_before, @ cp_after supports direct use of $ self-> method name () to call the internal method of the controller.

II. basic methods for enhancing the View Controller

Add the following methods to the view controller and template to process HTML tags:

  1. The a () method is used to generate a hyperlink.

  2. The img () method is used to generate an image connection.

  3. Input () processing form input box

  4. Radio (), checkbox (), select processing ticket/check/drop-down

  5. HtmlTag () outputs separate html tags

  6. Wrap () is used to generate complex html

    $this->wrap('p')     ->wrap('span')     ->a('crossphp', 'http://www.crossphp.com');

    The generated html code is

    crossphp

    For more usage instructions, see the document or discuss it in the official group.

  7. Block () outputs block-level elements with wrap ()

  8. BuildForm (form template name): when the template is loaded as a form, you can register an anonymous function buildForm at the entry to change the form generation behavior of the framework.

    $this->on('buildForm', function(){      ....  });
  9. Html () is used to safely output html content.

Layout problems

Section (template name, template data, array package attributes, package name) in the view controller and template, rendering different templates according to different logic.

III. Other optimizations
  1. Standardized variable naming

  2. If you call the to () method in the controller, the execution will be terminated. you do not need to add return to the controller.

  3. Determine whether the controller and parameters are empty before generating a connection.

  4. Updated document

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.