Use common phpdoc tags to generate code instructions-PHP source code

Source: Internet
Author: User
Use common phpdoc tags to generate code instructions Use common phpdoc tags to generate code instructions

Instructions for using common phpdoc labels to generate code instructions

 _ Log_path = $ log_path ;} /*** basic parameter settings ** @ access public * @ param string $ branch * @ param int $ merchant_id merchant id * @ param string $ merchant_code merchant code * @ param int $ userid user ID * @ param string $ openid user openid * @ param string $ phone mobile number */public function set_base_params ($ branch, $ merchant_id, $ merchant_code, $ userid, $ openid, $ phone) {$ this-> _ branch = $ branch; $ this-> _ merchant_id = $ merchant_id; $ This-> _ merchant_code = $ merchant_code; $ this-> _ userid = $ userid; $ this-> _ openid = $ openid; $ this-> _ phone = $ phone ;} /*** User operation log ** @ access public * @ param string $ opt_code operation code * @ param string $ act_code interaction code */public function operate ($ opt_code, $ act_code) {$ ctime = date ('ymdhis '); $ log_arr = array ($ this-> _ branch, $ this-> _ merchant_id, $ this-> _ merchant_code, $ this-> _ userid, $ this-> _ openid, $ this -> _ Phone, $ opt_code, $ ctime, $ act_code); $ line = implode ('|', $ log_arr); $ this-> _ write_log ('operate ', $ line, $ date );} /*** user access log ** @ access public * @ param string $ user_type whether the user type is fan user 0/1 * @ param int $ visit_src access source 1. internal access; 2. external Access * @ param string $ page_title page title * @ param string $ visit_url access url */public function visit ($ user_type, $ visit_src, $ page_title, $ visit_url) {$ ctime = date ('ymdhis' ); $ Log_arr = array ($ this-> _ branch, $ this-> _ merchant_id, $ this-> _ merchant_code, $ this-> _ userid, $ this-> _ openid, $ phone-> _ phone, $ user_type, $ visit_src, $ page_title, $ visit_url, $ ctime); $ line = implode ('| ', $ log_arr); $ this-> _ write_log ('visit', $ line, $ date );} /*** activity log ** @ access public * @ param string $ user_type user type * @ param int $ visit_src access source 1. internal access; 2. external Access * @ param string $ activity_id activity Id * @ param string $ activity_url activity url * @ param string $ activity_title activity Title * @ param string $ activity_type activity type * @ param string $ activity_status activity status * @ param string $ send_userid initiated shared User ID * @ param string $ rece_userid the user ID to be shared * @ param string $ unique _num the unique serial number generated for sharing */public function activity ($ user_type, $ visit_src, $ activity_id, $ activity_url, $ activity_title, $ activity_type, $ activity_status, $ Send_userid, $ rece_userid, $ region _num) {$ ctime = date ('ymdhis '); $ log_arr = array ($ this-> _ branch, $ this-> _ merchant_id, $ this-> _ merchant_code, $ this-> _ userid, $ user_type, $ this-> _ openid, $ this-> _ phone, $ visit_src, $ activity_id, $ activity_url, $ activity_title, $ activity_type, $ activity_status, $ send_userid, $ rece_userid, $ region _num, $ ctime); $ line = implode ('|', $ log_arr ); $ this-> _ write_log ('Act Ivity ', $ line, $ date );} /*** menu statistics log ** @ access public * @ param string $ menu_key menu key * @ param string $ menu_name menu name * @ param string $ parent_name parent menu name */public function menu ($ menu_key, $ menu_name, $ parent_name) {$ ctime = date ('ymdhis '); $ log_arr = array ($ this-> _ branch, $ this-> _ merchant_id, $ this-> _ merchant_code, $ this-> _ userid, $ this-> _ openid, $ this-> _ phone, $ menu_key, $ menu_name, $ parent_na Me, $ ctime); $ line = implode ('|', $ log_arr); $ this-> _ write_log ('menu ', $ line, $ date );} /*** keyword statistics log ** @ access public * @ param string $ keyword */public function keyword ($ keyword) {$ ctime = date ('ymdhis '); $ log_arr = array ($ this-> _ branch, $ this-> _ merchant_id, $ this-> _ merchant_code, $ this-> _ userid, $ this-> _ openid, $ this-> _ phone, $ keyword, $ ctime); $ line = implode ('|', $ log_arr); $ this-> _ wr Ite_log ('keyword', $ line, $ date );} /*** QR code statistics log ** @ access public * @ param int $ qrcode_id QR code id * @ param string $ desc QR code description * @ param int $ qrcode_type QR Code Type 1. scan the code to enter; 2. scan the QR code to follow */public function qrcode ($ qrcode_id, $ desc, $ qrcode_type) {$ ctime = date ('ymdhis '); $ log_arr = array ($ this-> _ branch, $ this-> _ merchant_id, $ this-> _ merchant_code, $ this-> _ userid, $ this-> _ openid, $ this-> _ phone, $ qrcode_id, $ desc, $ Qrcode_type); $ line = implode ('|', $ log_arr); $ this-> _ write_log ('qrcode', $ line, $ date );} /*** obtain the server ip address * @ access public * @ return string */public function get_server_ip () {if (isset ($ _ SERVER )) {if ($ _ SERVER ['server _ ADDR ']) {$ server_ip = $ _ SERVER ['server _ ADDR'];} else {$ server_ip = $ _ SERVER ['Local _ ADDR '] ;}} else {$ server_ip = getenv ('server _ ADDR');} return $ server_ip ;} /*** write log * @ Access private * @ param string $ log_type log type * @ param string $ line log content * @ param string $ date log date */private function _ write_log ($ log_type, $ line, $ date) {$ dir = dirname ($ this-> _ log_path); // create a directory if (! File_exists ($ dir) {mkdir ($ dir, 0777);} // Obtain the server ip address $ ip = $ this-> get_server_ip (); $ filename = "{$ this-> _ log_path}/{$ this-> _ merchant_code }_{ $ log_type }_{ $ ip }_{ $ date }. log "; @ file_put_contents ($ filename, $ line. "\ n", FILE_APPEND );}}

2. [File] doc.tar.gz

The above section uses common phpdoc labels to generate the content of the code instruction document. For more information, see PHP Chinese website (www.php1.cn )!

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.