PHP reverse test: extract the controller action method

Source: Internet
Author: User
PHP Reflection Test: extract the controller's action Method & lt ;? Php/*** Acl Resource Finder ** searches for the corresponding controller Directory: ** controller and its action list * and @ aclres-finder-desc {your comment} acl PHP Reflection Test: extract the controller's action method
 $ V) {// 1. remove the baseline path $ v = str_replace ($ basepath, '', $ v); // 2. remove the suffix $ v = preg_replace ('/\. php $/I ', '', $ v); // 3. split filter $ v = Core_AppUtils: normalize ($ v, DIRECTORY_SEPARATOR); if (empty ($ v) continue; $ paths [$ k] = implode ('_', $ v) ;}$ d = array (); foreach ($ paths as $ controller) {$ d [$ controller] = self: getActionListFromControllerClass ($ controller );} return $ d;} static function getActionListFromControllerClass ($ controll Er_name) {static $ controllerClassPrefix = null; if (! $ ControllerClassPrefix) {$ controllerClassPrefix = Core_App: ini ('mvc/web/dispatcher/controllerclassprefix', 'core _ Controller _');} $ clazz = "{$ controllerClassPrefix} {$ controller_name}"; Core_Autoloader: loadClass ($ clazz, true); $ obj = new ReflectionClass ($ clazz ); $ d = array (); $ publicMethods = $ obj-> getMethods (ReflectionMethod: IS_PUBLIC); foreach ($ publicMethods as $ method) {if (preg_match ('/^ action/I', $ method-> name) {$ action_name = preg_replace ('/^ action/I ','', $ method-> name); $ rmd = Core_Mvc_Router: resourceEncode ($ controller_name, $ action_name); $ q = array_shift ($ rmd); $ d [$ q] = self:: getAclResourceDescription ($ method-> getDocComment () ;}} return array ('description' => self: getAclResourceDescription ($ obj-> getDocComment ()), 'actions' => $ d);} static function getAclResourceDescription ($ finder) {static $ tagfinder_start = '@ aclres-finder-desc {'; static $ tagfinder_end = '} aclres-finder-desc @'; if (empty ($ finder) return ''; $ start = stripos ($ finder, $ tagfinder_start ); if ($ start) {$ end = stripos ($ finder, $ tagfinder_end); if ($ end & $ end> $ start) {// only closed tags are supported. $ start = $ start + strlen ($ tagfinder_start); return trim (substr ($ finder, $ start, $ end-$ start) ;}} return '';}}
? 1 floor vb2005xu 2012-05-31 http://www.php10086.com/page/3 good blog 2 floor vb2005xu 2012-05-31 http://opauth.org/3 floor vb2005xu 2012-06-01 http://www.shejidaren.com/category/css

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.