


discuz secondary development notes (1) ------$_G full analysis, discuz_g_PHP tutorial
discuz secondary development notes (1) ------$_G full analysis, discuz_g
$_G saves all preprocessed data in Discuz!
Caching can greatly improve the performance of the program. There is no need to query the database every time for some configuration data. You only need to update the cache when it is modified.
All caches in Discuz! are stored in $_G[cache]
$_G[member] Member information data
$_G[uid] User uid
$_G[username] User name
$_G[adminid] User management group id
$_G[groupid] User group id
$_G[setting] Setting data
$_G[cache] System cache
$_G[cache] [plugin] Plug-in cache
To load the cache, you can use the loadcache() function to load the cache into the $_G[cache] array
(1) Global Variable System
$_G['uid'] => Current login UID
$_G['username'] => Current login username
$_G[' adminid'] => Current login ID Management group ID
$_G['groupid'] => Current login ID User group ID
$_G['cookie'] => Client cookie
$_G['formhash'] => The [FORMHASH] of the current login ID is mainly used for form submission
$_G['timestamp' ] => Current activity time
$_G['starttime'] => 1317042440.3242
$_G['clientip'] => Current visitor IP address
$_G['referer'] = > Current requested address, main user form submission
$_G['charset'] => Program encoding
$_G['PHP_SELF'] => Relative address of the currently visited page
$_G ['siteurl'] => Program access address
$_G['siteroot'] => Relative directory of the domain name where the program is located
$_G['fid'] => Current section id [topic list page , Post page] appears
$_G['tid'] => Current post ID [Post page] appears
$_G['basescript'] => The channel where the current page is located
$_G[' basefilename'] => Current page php file name
$_G['staticurl'] => Program attachment directory
$_G['mod'] => The MOD value of the current page [for example: forum. php?mod=xxx】
$_G['inajax'] => The value of the current ajax request [None -0 Yes -1]
$_G['page'] => The current paging ID
$_G['tpp'] => The number displayed on each page of the current page
$_G['seokeywords'] => The current page's seo keywords
$_G['seodescription'] => The current page seo introduction
$_G['timenow'] => Array
(
[time] => 2011-9-26 21:07 Current server time
[offset] => 8 Current server time zone
)
$_G['config'] => Array(
$_G['config'][db] => Array(
$_G['config'] [db][1] => Array(
$_G['config'][db][1][dbhost] => localhost database connection address
$_G['config'][db] [1][dbuser] => root database username
$_G['config'][db][1][dbpw] => 123456 database password
$_G['config'][db ][1][dbcharset] => utf8 database encoding
$_G['config'][db][1][pconnect] => 0
$_G['config'][db][ 1][dbname] => dxutf database name
$_G['config'][db][1][tablepre] => pre_ data table prefix
)
)
)
(2) Global background settings
$_G['setting'][sitename] => Global-Site Information-Site Name
$_G[' setting'][siteurl] => Global-Site Information-Website URL
$_G['setting'][regname] => Global-Registration Access-Registration-Registration Address
$_G['setting'][reglinkname] => Global-Register Access-Register-Register Link Text
$_G['setting'][regverify] => Global-Register Access-Register-New User registration verification
$_G['setting'][icp] => Global-Site Information-Website Registration Information Code
$_G['setting'][imagelib] => Global-Upload Settings-Basic Settings-Image Processing Library Type
$_G['setting'][extcredits] => Print the points by yourself
$_G['setting'][creditsformula ] => Global - Points Settings - Basic Settings - Total Points Calculation Formula
$_G['setting'][cacheindexlife] => Global - Performance Optimization - Forum Page Cache Settings - Cache Forum Homepage Validity Period
$_G['setting'][cachethreaddir] => Global - Performance Optimization - Forum Page Cache Settings - Cache Directory
$_G['setting'][cachethreadlife] => Global - Performance Optimization - Forum page cache settings - Cache post validity period
$_G['setting'][bbrulestxt] => Global - Register for access - Registration - Website terms of service
$_G['setting' ][bbname] => Global-Site Information-Site Name
$_G['setting'][attachurl] => Global-Upload Settings-Basic Settings-Local Attachment URL Address
$_G['setting'][attachdir] => Global-Upload Settings-Basic Settings-Local Attachment Save Location
$_G['setting'][anonymoustext] => Interface-Interface Settings- Global - Anonymous user's nickname
$_G['setting'][threadsticky] => Interface - Interface settings - Topic list - Identity of the sticky topic
$_G['setting'] [defaultindex] => Default homepage file name forum.php
$_G['setting'][verify] => User-Authentication Settings
$_G['setting'][ rewriterule] => Background pseudo-static rule situation
$_G['setting'][ucenterurl] => UCenter address
$_G['setting'][plugins] => Background plug-in settings and activation
$_G['setting'][navlogos] => Backend interface settings - navigation settings - built-in navigation logo group
$_G['setting'] [navmn] => Navigation status set in the background, mainly used for navigation judgment
$_G['setting'][navs] => Page header navigation array, you can refer to this array to rewrite the page header navigation
$_G['setting'][footernavs] => Footer navigation
$_G['setting'][spacenavs] => Home module left navigation
$_G['setting'][mynavs] => Content of the shortcut navigation button on the right side of the page header
$_G['setting'][topnavs] => >$_G['setting'][forumpicstyle] => Array section theme cover
(
$_G['setting'][forumpicstyle][thumbwidth] => Theme cover width
$_G['setting'][forumpicstyle][thumbheight] => Theme cover height
)
$_G['setting'][activityfield] => Global - site function - activity theme - initiator required information
$_G['setting'][activityextnum] => Global - site function -Activity theme-Number of expanded data items
$_G['setting'][activitypp] => Global-Site function-Activity theme-User list shows the number of people participating in the activity on each page
$_G['setting'][activitycredit] => Global-Site Function-Activity Theme-Use Points
$_G['setting'][activitytype] => Global-Site Function-Activity Theme- Built-in type
$_G['setting'][adminemail] => Global-Site Information-Administrator Email
(3) Global Current Login User Information
$_G['member'] => Array Personal information of the currently logged in user
(
$_G['member'][uid] => UID
$_G['member'][email] => Email address
$_G['member'][username] => Username
$_G['member'][password] => Password after MD5 (don't input it randomly!! ! Remember) $_G['member'][status] => Whether the user has been deleted
$_G['member'][emailstatus] => Email verification status 0 Unverified 1 Verified
$_G ['member'][avatarstatus] => Avatar upload status 0 not uploaded 1 uploaded
$_G['member'][videophotostatus] => Video authentication 0 not authenticated 1 authenticated
$_G[ 'member'][adminid] => Management group ID
$_G['member'][groupid] => User group ID
$_G['member'][groupexpiry] => Validity period of the user group
$_G['member'][extgroupids] => Extended user group
$_G['member'][regdate] => Registration time
$_G['member' ][credits] => 214 Total existing points
$_G['member'][notifysound] => SMS sound
$_G['member'][timeoffset] => Time zone
$_G['member'][newpm] => Number of new short messages
$_G['member'][newprompt] => Number of new reminders
$_G['member'][accessmasks ] => This looks like access permissions, not sure
$_G['member'][allowadmincp] => Do you have management panel permissions 0 No 1 Yes
$_G['member'][onlyacceptfriendpm] = > Whether to only accept short messages from friends 0 No 1 Yes
$_G['member'][conisbind] => Whether to bind QQ 0 No 1 Yes
$_G['member'][lastvisit] = > Last visit time
);
(4) Style Variables
$_G['style'] => Array(
$_G['style'][styleid] => Current style ID
$_G[' style'][name] => Current style name
$_G['style'][templateid] => Current template system
$_G['style'][tpldir] => Current template directory
$_G['style'][menuhoverbgcolor] => Navigation menu highlight background color
$_G['style'][lightlink] => Light link color
$_G['style '][floatbgcolor] => Pop-up window background attribute
$_G['style'][dropmenubgcolor] => Drop-down menu background attribute $_G['style'][floatmaskbgcolor] => Pop-up window border color attribute
$_G['style'][dropmenuborder] => Drop-down menu border color
$_G['style'][specialbg] => Colored area background color (post user information bar, tables that need to be emphasized First class)
$_G['style'][specialborder] => Colored area border
$_G['style'][commonbg] => Common display area background color
$_G['style '][commonborder] => Common border color
$_G['style'][inputbg] => Input box background color
$_G['style'][inputborderdarkcolor] => Input box border Dark
$_G['style'][headerbgcolor] => Header background
$_G['style'][headerborder] => Header dividing line height
$_G['style '][sidebgcolor] => Home side background
$_G['style'][msgfontsize] => Post content font size
$_G['style'][bgcolor] => Page background
$_G['style'][noticetext] => Prompt message color
$_G['style'][highlightlink] => Highlight link color
$_G['style'][link ] => Link text color
$_G['style'][lighttext] => Light text
$_G['style'][midtext] => Medium text color
$_G ['style'][tabletext] => Normal text color
$_G['style'][smfontsize] => Small font size
$_G['style'][threadtitlefont] => Topic list font
$_G['style'][threadtitlefontsize] => Topic list font size
$_G['style'][smfont] => Small font
$_G['style '][titlebgcolor] => Section list title font color $_G['style'][fontsize] => Normal font size
$_G['style'][font] => Normal font
$_G['style'][styleimgdir] => Extended picture directory
$_G['style'][imgdir] => Interface basic picture directory
$_G['style'][boardimg] = > The path where the logo is located
$_G['style'][headertext] => Header text color
$_G['style'][footertext] => Footer text color
$_G ['style'][menubgcolor] => Navigation menu background color
$_G['style'][menutext] => Navigation menu text color
$_G['style'][menuhovertext] => ; Navigation menu highlighted text color
$_G['style'][wrapbg] => Main table background color
$_G['style'][wrapbordercolor] => Main table border color
$_G['style'][contentwidth] => Reading area width
$_G['style'][contentseparate] => Post separation color
$_G['style'][inputborder] => ; Input box border light color
$_G['style'][menuhoverbgcode] => Navigation menu highlight background
$_G['style'][floatbgcode] => Pop-up window background color
$_G['style'][dropmenubgcode] => Drop-down menu background color
$_G['style'][floatmaskbgcode] => Pop-up window border color
$_G['style'][headerbgcode] => Header background
$_G['style'][sidebgcode] => Home sidebar background attribute
$_G['style'][bgcode] => Global background attribute
$_G['style'][titlebgcode] => Section list title background$_G['style'][menubgcode] => Navigation menu background attribute
$_G['style'][boardlogo] => ; LOGO img code
)

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use