dede global.cfg tel是什么?配置还是变量?

99ANYc3cd6
预计阅读时长 16 分钟
位置: 首页 DEDE建站 正文

Of course. Let's break down the tel setting in the global.cfg file for DedeCMS (织梦CMS).

dede global.cfg tel
(图片来源网络,侵删)

What is global.cfg?

First, it's important to clarify the file name. In DedeCMS, the main configuration file is typically named config_inc.php, not global.cfg. The global.cfg file you're referring to is likely the dede/config.cache.inc.php file.

This file is automatically generated by DedeCMS and contains cached configuration settings from the system's main configuration panel. It is read-only and should never be edited directly. Any changes you need to make should be done through the DedeCMS backend administration panel.

What is the cfg_tel Setting?

The cfg_tel variable in this file stores the primary contact telephone number for your website. This information is used in various parts of the site, most commonly in the website's footer.

How to Change the cfg_tel Value (The Correct Way)

You should never edit config.cache.inc.php by hand because your changes will be overwritten the next time the system cache is updated.

dede global.cfg tel
(图片来源网络,侵删)

Follow these steps to change the phone number correctly through the DedeCMS admin panel:

  1. Log in to your DedeCMS backend.
  2. Navigate to "System" (系统) in the main menu.
  3. Select "System Basic Parameters" (系统基本参数).
  4. On the "Basic Parameters" (基本参数) page, find the "Website Info" (网站信息) section.
  5. Look for the field named "Contact Tel" (联系电话).
  6. Enter your desired phone number in this field.
  7. Scroll down to the bottom of the page and click the "Save" (保存) button.

After saving, DedeCMS will automatically update the config.cache.inc.php file in the dede directory with your new value.

Where is the cfg_tel Value Used?

Once you set the phone number in the backend, it will appear on your website wherever the template code calls for it. The most common place is the footer.

To display the phone number in your template files (e.g., footer.htm), you would use the DedeCMS global variable:

dede global.cfg tel
(图片来源网络,侵删)
{dede:global.cfg_tel/}

Example in a Footer Template (footer.htm):

<footer>
    <div class="container">
        <p>Copyright &copy; 2025 Your Company Name. All Rights Reserved.</p>
        <p>Contact Us: {dede:global.cfg_tel/} | Email: info@yourcompany.com</p>
    </div>
</footer>

When the page is loaded, {dede:global.cfg_tel/} will be replaced with the actual phone number you set in the admin panel.

Security Warning: The cfg_dbpwd Issue

It's very important to mention that the config.cache.inc.php file also contains sensitive information, most notably your database password (cfg_dbpwd).

Because this file is world-readable by default on a web server, it can be a security risk if your site is not properly secured.

How to improve security:

  1. Restrict File Permissions: Set the permissions of config.cache.inc.php so that it is only readable by the web server user and not by the public. A common permission setting is 640.

    • On Linux: chmod 640 /path/to/your/dede/config.cache.inc.php
  2. Use .htaccess (for Apache): You can add the following lines to your website's root .htaccess file to prevent direct access to the file.

    <Files "config.cache.inc.php">
        Order allow,deny
        Deny from all
    </Files>
  3. Use web.config (for IIS): You can add a rule in your web.config file to block access to the file.

    <system.webServer>
        <security>
            <requestFiltering>
                <hiddenSegments>
                    <add segment="dede/config.cache.inc.php" />
                </hiddenSegments>
            </requestFiltering>
        </security>
    </system.webServer>

Summary

Item Description
File Name dede/config.cache.inc.php (not global.cfg)
Variable $cfg_tel
Purpose Stores the website's main contact phone number.
How to Change Do not edit the file directly. Go to System > System Basic Parameters and edit the "Contact Tel" field.
How to Use In templates, use {dede:global.cfg_tel/} to display the number.
Security This file contains sensitive data like the database password. Secure it by restricting its permissions.
-- 展开阅读全文 --
头像
构成C语言程序的基本单位是什么?
« 上一篇 12-06
switch default c语言
下一篇 » 12-06

相关文章

取消
微信二维码
支付宝二维码

目录[+]