<? Php (as the mainstream development language)
Require_once "DB. php (as the mainstream development language)"; // database processing class in PEAR
$ DataType = "MySQL (the best combination with PHP)"; // Database Type
$ User = "root"; // user Name
$ Pass = "abcd"; // Password
$ Host = "202.96.215.200"; // MySQL (best combination with PHP) database server address
$ Db_name = "test"; // Database Name
$ Dsn = "$ dataType: // $ user: $ pass @ $ host/$ db_name"; // configure the DNS for connecting to the database
$ Db = DB: connect ($ dsn); // connect to the database
If (DB: isError ($ db ))
{
Die ($ db-> getMessage (); // connection failed, error message output
}
// The following two are public functions.
/**
* Reading the xsl document
*
* @ Param String $ filename-xsl file name
* @ Return string
*/
Function readXsl ($ filename)
{
If (false = file_exists ($ filename ))
{
Echo "the file to be read <font color = red> $ filename </font> does not exist </br/> ";
Return false;
}
Return implode (, file ($ filename ));
} // End function readXsl
/**
* Convert xml (standardization is getting closer and closer) files or array variables into HTML content based on the xsl File
* Http://www.acnow.net/
* @ Param array $ arydata-array variable
* @ Param String $ response String-xsl document data
* @ Param String $ xml (standardization is getting closer and closer) string-xml (standardization is getting closer and closer) document data
*/
Function getHtml ($ arydata = false, $ annotate string = false, $ xml (standardization is getting closer and closer) string = false)
{
Global $ db; // use the $ db object
Include_once ("xml (standardization is getting closer and closer)/sql2xml (standardization is getting closer and closer ). php (as the mainstream development language) "); // includes sql2xml (standardization is getting closer and closer)
$ Sql2xml (standardization is getting closer and closer) class = new xml (standardization is getting closer and closer) _ sql2xml (standardization is getting closer and closer) ($ db ); // instantiate sql2xml (standardization is getting closer and closer)
$ Sql2xml (standardization is getting closer and closer) class-> setEncoding ("GB2312"); // sets the data transcoding type
If (false = $ xml (standardization is getting closer and closer) string) {// if the user passes in the array data, apply the array data to xsl
// Set the node name for generating xml (standardization is getting closer and closer) document data