本文整理汇总了PHP中Load::library方法的典型用法代码示例。如果您正苦于以下问题:PHP Load::library方法的具体用法?PHP Load::library怎么用?PHP Load::library使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Load
的用法示例。
在下文中一共展示了Load::library方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
// load the config object
$config = Load::library('Config');
// get the connection name based off the enviroment
$connection = $config->getEnvironment();
// load the connection details
$details = $config->get('connections.' . $connection);
try {
// instantiate the PDO object
$this->dbh = parent::__construct($details[0], $details[1], $details[2]);
} catch (PDOException $e) {
if ($config->isDev()) {
// throw the original exception
throw new Exception('PDO exception caught: ' . $e->getMessage());
} else {
// throw the generic DB exception
throw new Exception('Database connection error');
}
}
// set the PDO error mode to exception
parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// return the DB handle
return $this->dbh;
}
示例2: ws
public function ws()
{
Load::library('WebService');
$server = new SoapServer(null, array('uri' => 'http://localhost/freekore/test/ws'));
// Asignamos la Clase
$server->setClass('WebService');
// Atendemos las peticiones
$server->handle();
$server->getFunctions();
}
示例3: __construct
<?
Load::library('ODateInterval');
class ODateTime extends DateTime {
public function __construct($dateTime=null, $timezone=null) {
if(!$dateTime) throw new Exception('Date/time is null');
parent::__construct($dateTime);
}
public function __toString() {
return $this->format('d M Y h:i a');
}
public function diff($dateTime=null, $absolute=false, $invert=false) {
if($dateTime === null) $dateTime = new DateTime();
$x = parent::diff($dateTime, $absolute);
if($invert) {
if($x->invert) $x->invert = 0;
else $x->invert = 1;
}
return new DTDateInterval($x);
}
public function icalDateTime() {
$utc = new DateTimeZone('UTC');
$tmp = clone $this;
$tmp->setTimezone($utc);
return $tmp->format('Ymd')."T".$tmp->format('His')."Z";
}
public function icalDate() {
$utc = new DateTimeZone('UTC');
$tmp = clone $this;
$tmp->setTimezone($utc);
return $tmp->format('Ymd');
}
示例4: define
<?php
// define several important path constants
define('SYS_PATH', realpath('../system/'));
define('APP_PATH', realpath('../system/application'));
define('LIB_PATH', realpath('../system/library'));
define('LOG_PATH', realpath('../system/logs'));
// include the Load class for all future object instantiation
require_once LIB_PATH . '/Load.php';
// include the base Controller class
require_once LIB_PATH . '/Controller.php';
// include the base Model class
require_once LIB_PATH . '/Model.php';
// create the Config instance and set to singleton
$config = Load::library('Config');
// instantiate the router class
$router = Load::library('Router');
// EOF
示例5: importExcelData
public function importExcelData($file, $tablefields)
{
// Test CVS
set_time_limit(0);
//require_once 'Excel/reader.php';
Load::library('phpExcelReader/Excel/reader');
// ExcelFile($filename, $encoding);
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$data->setOutputEncoding('CP1251');
/***
* if you want you can change 'iconv' to mb_convert_encoding:
* $data->setUTFEncoder('mb');
*
**/
/***
* By default rows & cols indeces start with 1
* For change initial index use:
* $data->setRowColOffset(0);
*
**/
/***
* Some function for formatting output.
* $data->setDefaultFormat('%.2f');
* setDefaultFormat - set format for columns with unknown formatting
*
* $data->setColumnFormat(4, '%.3f');
* setColumnFormat - set format for column (apply only to number fields)
*
**/
//$data->read(SYSTEM_PATH.'app/libraries/phpExcelReader/RP 030 LG13 0206WM MBA1PR COLOTLAN columnas.xls');
$data->read($file);
/*
$data->sheets[0]['numRows'] - count rows
$data->sheets[0]['numCols'] - count columns
$data->sheets[0]['cells'][$i][$j] - data from $i-row $j-column
$data->sheets[0]['cellsInfo'][$i][$j] - extended info about cell
$data->sheets[0]['cellsInfo'][$i][$j]['type'] = "date" | "number" | "unknown"
if 'type' == "unknown" - use 'raw' value, because cell contain value with format '0.00';
$data->sheets[0]['cellsInfo'][$i][$j]['raw'] = value if cell without format
$data->sheets[0]['cellsInfo'][$i][$j]['colspan']
$data->sheets[0]['cellsInfo'][$i][$j]['rowspan']
*/
error_reporting(E_ALL ^ E_NOTICE);
echo '<table border="1" class="tbl-1">';
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
if ($i == 1) {
// HEader
echo '<thead><tr>';
echo '<th><input type="checkbox" name="chkAll" id="chkAll" onclick="checkAll($(this),\'chkRow\');" value="all" ></th>';
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
foreach ($tablefields as $fieldName => $fieldLabel) {
$array[$fieldName] = $fieldLabel;
}
echo "<th>";
echo '<select name="col-' . ($j - 1) . '"><option value="">[X]Ignorar</option>' . fk_select_options_r($array) . '</select>';
if ($this->display_rules) {
echo '<textarea name="rules[]" placeholder="Reglas"></textarea>';
}
echo "</th>";
}
echo '</tr></thead>';
}
$trTieneDatos = 0;
$tr = '<tr>';
$tr .= '<th><input type="checkbox" class="chkRow" name="rows[]" value="' . $i . '" ></th>';
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
$tr .= '<td>';
$tr .= utf8_encode($data->sheets[0]['cells'][$i][$j]);
//$tr .= '<input type="hidden" name="txt_'.$i.'[]" value="'.$data->sheets[0]['cells'][$i][$j].'">';
$tr .= '<textarea style="display:none" name="txt_' . $i . '[]">' . utf8_encode($data->sheets[0]['cells'][$i][$j]) . '</textarea>';
$tr .= '</td>';
if (trim($data->sheets[0]['cells'][$i][$j]) != '') {
$trTieneDatos++;
}
}
$tr .= '</tr>';
if ($trTieneDatos > 0) {
echo $tr;
}
}
echo '</table>';
echo '<h3> ' . $data->sheets[0]['numRows'] . ' registros encontrados</h3>';
}
示例6: __construct
public function __construct()
{
$this->db = Load::library('DB');
}
示例7: setEnvironment
private function setEnvironment($overwrite = false)
{
$uri = Load::library('URI');
if (!empty($overwrite)) {
// we're overwriting the default environment
$env = $overwrite;
} else {
$prod_exps = $this->get('server.prod_exps');
foreach ($prod_exps as $exp) {
if (preg_match($exp, $_SERVER['SCRIPT_URI'])) {
// we're on the production site
$env = 'prod';
// break as we have a valid match
break;
}
}
}
if (empty($env)) {
// we're on the development site
$env = 'dev';
}
// set the server enviroment
$this->set('server.environment', $env);
// store environment in a session
$this->session->set('sess_env', $env);
}
示例8: __construct
public function __construct()
{
$this->view = Load::library('View');
$this->config = Load::library('Config');
}
示例9: __construct
public function __construct()
{
$this->Uri = Load::library('URI');
$this->Config = Load::library('Config');
$this->initRouting();
}
示例10: recuperar_clave
public function recuperar_clave()
{
$this->template = 'mailer';
if ($this->has_post('login') && $this->Usuarios->loginExist($this->post('login'))) {
Load::library('mail');
$this->passNew = Mail::generarClave(6);
$this->usuario = $this->Usuarios->updateUsuarioByMail($this->post('login'), $this->passNew);
$this->render('mailer');
}
}
示例11: __construct
public function __construct()
{
$this->Uri = Load::library('URI');
$this->Config = Load::library('Config');
$this->parseRoute();
}
示例12: recuperar_clave
public function recuperar_clave()
{
View::template('mailer');
$usuarios = new Usuarios();
if (Input::hasPost('login') && $this->Usuarios->loginExist(Input::post('login'))) {
Load::library('mail');
$this->passNew = Mail::generarClave(6);
$this->usuario = $usuarios->updateUsuarioByMail(Input::post('login'), $this->passNew);
View::select('mailer');
}
}
示例13: define
<?php
// define several important path constants
define('SYS_PATH', realpath('../system/'));
define('APP_PATH', realpath('../system/application'));
define('LIB_PATH', realpath('../system/library'));
define('LOG_PATH', realpath('../system/logs'));
// include the Load class for all future object instantiation
require_once LIB_PATH . '/Load.php';
// include the static logger class
require_once LIB_PATH . '/Logger.php';
// include the base Controller class
require_once LIB_PATH . '/Controller.php';
// include the base Model class
require_once LIB_PATH . '/Model.php';
// include the global exception
require_once APP_PATH . '/exceptions/global.php';
// create the Config instance and set to singleton
$config = Load::library('Config');
// instantiate the router class
$router = Load::library('Application');
// EOF
示例14: loadLibrary
/**
* loadLibrary method
* @param null/string $library
* */
private function loadLibrary($library)
{
$className = ucfirst($library);
$this->library->{$className} = $this->library->{lcfirst($className)} = Load::library($className);
}