Dedecms V5.7 Method of Calling Database of Other Sites


Question: The website was written in decms v5.7, and later added a set of forum discuzX3.4. Because Dede calls DZ data, it originally uses jsonp cross-domain request data, but when the m-terminal is used, it will automatically add a / m after the domain name of the requested link. So I went online and found another way, Dede called dz’s database directly.



1. Open the / data/tag/ file under dedecms and add a little code:

// DZ database connection configurationdzdb']['dbhost'] = 'localhost';
$sqltag['dzdb']['dbname'] = 'phpb2b';
$sqltag['dzdb']['dbuser'] = 'root';
$sqltag['dzdb']['dbpwd'] = '123456';
$sqltag['dzdb']['dbprefix'] = 'pb_';
$sqltag['dzdb']['dblanguage'] = 'utf8';

Fill in DZ database information correctly in sql. Inc. PHP file according to the above format

2. Calling DZ data in a template

{dede:sql sql="SELECT * FROM x_forum_post DESC LIMIT 15" appname="dzdb"}

Or write as dede: SQL does. You need to add an appName =’dzdb’to the tag.

Then OK!