<?php
//打印用户
$resource = Mage::getSingleton('core/resource');
$conn = $resource->getConnection('core_read');
$results = $conn->query('SELECT * FROM admin_user')->fetchAll();
echo '<pre>';
var_export($results);
echo '</pre>';
?>
<?php
//打印session
$singleton = Mage::getSingleton('catalog/session');
echo '<pre>';
var_export($singleton->debug());
echo '</pre>';
?>
<?php
$conf = array(
'host' => 'localhost',
'username' => 'root',
'password' => 'pwd',
'dbname' => 'wordpress' // you can any database name here
);
$_resource = Mage::getSingleton('core/resource');
//Creating new connection to new server and new database
$_conn = $_resource->createConnection('customConnection',
'pdo_mysql', $conf);
$results = $_conn->query('SELECT * FROM wp_posts')->fetchAll();
echo '<pre>';
print_r($results);
echo '</pre>';
?>
<?php
//连接数据库
$conf = array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'hhl' // you can any database name here
);
$_resource = Mage::getSingleton('core/resource');
//Creating new connection to new server and new database
$_conn = $_resource->createConnection('customConnection',
'pdo_mysql', $conf);
$results = $_conn->query('SELECT * FROM hhl_activety')->fetchAll();
echo '<pre>';
print_r($results);
echo '</pre>';
?>
//打印用户
$resource = Mage::getSingleton('core/resource');
$conn = $resource->getConnection('core_read');
$results = $conn->query('SELECT * FROM admin_user')->fetchAll();
echo '<pre>';
var_export($results);
echo '</pre>';
?>
<?php
//打印session
$singleton = Mage::getSingleton('catalog/session');
echo '<pre>';
var_export($singleton->debug());
echo '</pre>';
?>
<?php
$conf = array(
'host' => 'localhost',
'username' => 'root',
'password' => 'pwd',
'dbname' => 'wordpress' // you can any database name here
);
$_resource = Mage::getSingleton('core/resource');
//Creating new connection to new server and new database
$_conn = $_resource->createConnection('customConnection',
'pdo_mysql', $conf);
$results = $_conn->query('SELECT * FROM wp_posts')->fetchAll();
echo '<pre>';
print_r($results);
echo '</pre>';
?>
<?php
//连接数据库
$conf = array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'hhl' // you can any database name here
);
$_resource = Mage::getSingleton('core/resource');
//Creating new connection to new server and new database
$_conn = $_resource->createConnection('customConnection',
'pdo_mysql', $conf);
$results = $_conn->query('SELECT * FROM hhl_activety')->fetchAll();
echo '<pre>';
print_r($results);
echo '</pre>';
?>