directory search
Array Array Helper Benchmarking Benchmarking Class Caching Caching Driver Calendaring Calendaring Class CAPTCHA CAPTCHA Helper Config Config Class Cookie Cookie Helper Database Connecting to your Database Custom Function Calls Database Caching Class Database Configuration Database Forge Class Database Metadata Database Quick Start: Example Code Database Reference Database Utility Class DB Driver Reference Generating Query Results Queries Query Builder Class Query Helper Methods Transactions Date Date Helper Directory Directory Helper Download Download Helper Email Email Class Email Helper Encrypt Encrypt Class Encryption Encryption Library File File Helper File Uploading File Uploading Class Form Form Helper Form Validation Form Validation FTP FTP Class Functions compatibility_functions common_functions HTML HTML Helper HTML Table HTML Table Class Image Manipulation Image Manipulation Class Inflector Inflector Helper Input Input Class Javascript Javascript Class Language Language Class Language Helper Loader Loader Class Migrations Migrations Class Number Number Helper Output Output Class Pagination Pagination Class Path Path Helper Security Security Class Security Helper Session Session Library Shopping Cart Shopping Cart Class Smiley Smiley Helper String String Helper Template Parser Template Parser Class Text Text Helper Trackback Trackback Class Typography Typography Class Typography Helper Unit Testing Unit Testing Class URI URL User Agent XML XML-RPC and XML-RPC Server Zip Encoding Zip Encoding Class XML-RPC and XML-RPC Server Classes XML Helper User Agent Class URL Helper URI Class
characters

$this - > DB-> call_function();

该函数使您能够以独立于平台的方式调用本地不包含在CodeIgniter中的PHP数据库函数。例如,假设你想调用mysql_get_client_info()函数,CodeIgniter本身支持这个函数。你可以这样做:

$this->db->call_function('get_client_info');

您必须在第一个参数中提供没有 mysql_前缀的函数的名称。前缀是根据当前正在使用的数据库驱动程序自动添加的。这允许您在不同的数据库平台上运行相同的功能。很明显,并不是所有的函数调用在平台之间都是相同的,所以这个函数在可移植性方面的用处是有限的。

您正在调用的函数所需的任何参数都将被添加到第二个参数中。

$this->db->call_function('some_function', $param1, $param2, etc..);

通常,您需要提供数据库连接标识或数据库结果标识。连接ID可以通过以下方式访问:

$this->db->conn_id;

结果ID可以从结果对象中访问,如下所示:

$query = $this->db->query("SOME QUERY");$query->result_id;
Previous article: Next article: