最近在研究discuz! 但就是搞不懂他怎么在输入127.0.0.1/forum.php后直接加载discuz.htm这个模板呢,百思不得其解.记住本帖一定要说道理,不能干巴巴的,否则是不给分的,这回给分可是不少啊. 一百分
<?php/** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: forum.php 33828 2013-08-20 02:29:32Z nemohou $ */define('APPTYPEID', 2);define('CURSCRIPT', 'forum');require './source/class/class_core.php';require './source/function/function_forum.php';$modarray = array('ajax','announcement','attachment','forumdisplay', 'group','image','index','medal','misc','modcp','notice','post','redirect', 'relatekw','relatethread','rss','topicadmin','trade','viewthread','tag','collection','guide');$modcachelist = array( 'index' => array('announcements', 'onlinelist', 'forumlinks', 'heats', 'historyposts', 'onlinerecord', 'userstats', 'diytemplatenameforum'), 'forumdisplay' => array('smilies', 'announcements_forum', 'globalstick', 'forums', 'onlinelist', 'forumstick', 'threadtable_info', 'threadtableids', 'stamps', 'diytemplatenameforum'), 'viewthread' => array('smilies', 'smileytypes', 'forums', 'usergroups', 'stamps', 'bbcodes', 'smilies', 'custominfo', 'groupicon', 'stamps', 'threadtableids', 'threadtable_info', 'posttable_info', 'diytemplatenameforum'), 'redirect' => array('threadtableids', 'threadtable_info', 'posttable_info'), 'post' => array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist', 'albumcategory'), 'space' => array('fields_required', 'fields_optional', 'custominfo'), 'group' => array('grouptype', 'diytemplatenamegroup'),);$mod = !in_array(C::app()->var['mod'], $modarray) ? 'index' : C::app()->var['mod'];define('CURMODULE', $mod);$cachelist = array();if(isset($modcachelist[CURMODULE])) { $cachelist = $modcachelist[CURMODULE]; $cachelist[] = 'plugin'; $cachelist[] = 'pluginlanguage_system';}if(C::app()->var['mod'] == 'group') { $_G['basescript'] = 'group';}C::app()->cachelist = $cachelist;C::app()->init();loadforum();set_rssauth();runhooks();$navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['forum']);$_G['setting']['threadhidethreshold'] = 1;require DISCUZ_ROOT.'./source/module/forum/forum_'.$mod.'.php';?>
回复讨论(解决方案)
上面这段代码里面在逻辑上就没有discuz这个变量存在,所以俺就是纳闷,他为啥能加载呢
$mod = !in_array(C::app()->var['mod'], $modarray) ? 'index' : C::app()->var['mod'];
没有mod参数就是mod=index;
你到/source/module/forum下就能找到forum_index.php
这就是首页的后台文件
在最后include template('diy:forum/discuz:'.$gid);
就是引入了discuz.html
道理,不能干巴巴的
$mod = !in_array(C::app()->var['mod'], $modarray) ? 'index' : C::app()->var['mod'];
没有mod参数就是mod=index;
你到/source/module/forum下就能找到forum_index.php
这就是首页的后台文件
在最后include template('diy:forum/discuz:'.$gid);
就是引入了discuz.html
嗯,你说的真明白,你肯定能获得分了,不过我还有个问题,能解答下吗?$mod = !in_array(C::app()->var['mod'], $modarray) ? 'index' : C::app()->var['mod'];句中的"C::app()->var['mod']"我不理解,这里的双冒号是类中的静态方法吧?还是个啥?如是静态方法,那app()是怎么来的?我搜了一下var这个数组没有呢,是不是我理解错了.肯定给你分的.骗你小狗.
C类:source/class/class_core.php,在文件最下面,继承了core类,就在本文件的上面,在core类的上面调用了C::creatapp();此静态方法用到了discuz_application::instance();
discuz_application类:source/class/discuz/discuz_application.php,这个类是核心类,所有入口文件调用的其实就是它,里面定义了$var数组,并有一句$this->var = & $_G;,我想$_G不会不认识吧,所以$_G['mod']也能获取mod的参数值

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.