• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CI类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CI的典型用法代码示例。如果您正苦于以下问题:PHP CI类的具体用法?PHP CI怎么用?PHP CI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: alterTables

 function alterTables()
 {
     $this->loadAdapter();
     $CI = new CI(-1);
     $CIA = $CI->newAttributes();
     switch ($this->A("PatchType")) {
         case "mysql":
             $v = explode("\n", $this->A("PatchValue"));
             foreach ($v as $key => $value) {
                 $CIA->MySQL = $value;
                 $this->Adapter->alterTable($CIA);
             }
             break;
     }
 }
开发者ID:nemiah,项目名称:projectMankind,代码行数:15,代码来源:Patch.class.php


示例2: index

 function index()
 {
     header("Content-type: text/plain");
     $segs = $this->uri->segment_array();
     $cron_group = false;
     $force = false;
     $action = false;
     foreach ($segs as $segment) {
         if (stristr($segment, 'g:') == true) {
             $cron_group = substr($segment, 2, strlen($segment));
             ///	exit($cron_group);
         }
         if (stristr($segment, 'force:true') == true) {
             $force = true;
         }
         if (stristr($segment, 'a:') == true) {
             $action = substr($segment, 2, strlen($segment));
         }
     }
     $job = CI::model('core')->cronjobGetOne($cron_group, $force, $action);
     if (!empty($job)) {
         print "\n\n" . 'Begin - ' . date("Y-m-d H:i:s") . ' - ' . $job['cronjob_name'] . "\n";
         $to_exc = '$this->' . $job['model_name'] . '->' . $job['function_to_execute'];
         //print $to_exc;
         eval($to_exc . ';');
         print "\n" . 'End - ' . date("Y-m-d H:i:s") . ' - ' . $job['cronjob_name'] . "\n\n";
     } else {
         print "\n" . 'No jobs - ' . date("Y-m-d H:i:s") . "\n\n";
     }
     //var_dump($job);
     //print 'cron-' . date("Y-m-d H:i:s");
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:32,代码来源:cron.php


示例3: index

 public function index($slug)
 {
     $product = \CI::Products()->slug($slug);
     if (!$product) {
         throw_404();
     } else {
         $product->images = json_decode($product->images, true);
         if ($product->images) {
             $product->images = array_values($product->images);
         } else {
             $product->images = [];
         }
         //set product options
         $data['options'] = \CI::ProductOptions()->getProductOptions($product->id);
         $data['posted_options'] = \CI::session()->flashdata('option_values');
         //get related items
         $data['related'] = $product->related_products;
         //create view variable
         $data['page_title'] = $product->name;
         $data['meta'] = $product->meta;
         $data['seo_title'] = !empty($product->seo_title) ? $product->seo_title : $product->name;
         $data['product'] = $product;
         //load the view
         $this->view('product', $data);
     }
 }
开发者ID:thijmenvenus,项目名称:GoCart3,代码行数:26,代码来源:Product.php


示例4: logout

 public function logout()
 {
     \CI::auth()->logout();
     //when someone logs out, automatically redirect them to the login page.
     \CI::session()->set_flashdata('message', lang('message_logged_out'));
     redirect('admin/login');
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:7,代码来源:AdminLogin.php


示例5: getTerm

 function getTerm($code)
 {
     CI::db()->select('term');
     $result = CI::db()->get_where('search', array('code' => $code));
     $result = $result->row();
     return $result->term;
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:7,代码来源:Search.php


示例6: delete

 function delete()
 {
     $id = $_POST['to_table_id'];
     if (intval($id) == 0) {
         exit('id?');
     } else {
         global $cms_db_tables;
         $id = intval($_POST['to_table_id']);
         $real_table = $cms_db_tables[$_POST['to_table']];
         $q = "delete from {$real_table} where id={$id}  ";
         $q = CI::model('core')->dbQ($q);
         $table = $cms_db_tables['table_reports'];
         $q = "delete from {$table} where to_table='{$_POST['to_table']}' and to_table_id='{$_POST['to_table_id']}'  ";
         $q = CI::model('core')->dbQ($q);
         CI::model('core')->cleanCacheGroup('reports');
         switch ($_POST['to_table']) {
             case 'table_content':
                 CI::model('core')->cleanCacheGroup('content');
                 break;
             case 'table_comments':
                 CI::model('core')->cleanCacheGroup('comments');
                 break;
             default:
                 CI::model('core')->cacheDeleteAll();
                 break;
         }
         //CI::model('comments')->commentsDeleteById ( $id );
     }
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:29,代码来源:reports.php


示例7: generate

 public function generate()
 {
     $type = CI::uri()->segment(1);
     $slug = CI::uri()->segment(2);
     if (!$type || !$slug) {
         return;
         //return blank
     }
     if ($type == 'category') {
         $category = CI::Categories()->slug($slug);
         if (!$category) {
             return;
         }
         $this->trace_categories($category->id);
     } elseif ($type == 'product') {
         $product = CI::Products()->slug($slug);
         if (!$product) {
             return;
         }
         array_unshift($this->breadcrumbs, ['link' => site_url('product/' . $product->slug), 'name' => $product->name]);
         $this->trace_categories($product->primary_category);
     } elseif ($type == 'page') {
         $page = CI::Pages()->slug($slug);
         if (!$page) {
             return;
         }
         $this->trace_pages($page->id);
     }
     echo GoCart\Libraries\View::getInstance()->get('breadcrumbs', ['breadcrumbs' => $this->breadcrumbs]);
 }
开发者ID:thijmenvenus,项目名称:GoCart3,代码行数:30,代码来源:Breadcrumbs.php


示例8: generator

 public function generator($eng, $alt)
 {
     $cos_phi = 0.8;
     $engine = \CI::Products()->getProduct($eng);
     $engine->manufacturer = \CI::Products()->getManufacturers($engine->manufacturers);
     $alternator = \CI::Products()->getProduct($alt);
     $alternator->manufacturer = \CI::Products()->getManufacturers($alternator->manufacturers);
     $engine_parameters = \CI::Products()->getParameters($engine->id, 'engines');
     $engine_alternator = \CI::Products()->getParameters($alternator->id, 'alternators');
     //echo '<pre>';print_r($alternator);exit;
     $data['page_title'] = $engine->name;
     $data['meta'] = $engine->meta;
     $data['seo_title'] = !empty($engine->seo_title) ? $engine->seo_title : $engine->name;
     $data['product'] = $engine;
     $data['engine_parameters'] = $engine_parameters;
     $data['alt'] = $alternator;
     $data['engine_alternator'] = $engine_alternator;
     $generators = array();
     $generators['kVA'] = $generators['kVA_standby'] = $engine_parameters->standby / $cos_phi * ($engine_alternator->efficiency * 0.01);
     $generators['kVA_prime'] = $engine_parameters->prime / $cos_phi * ($engine_alternator->efficiency * 0.01);
     $generators['price'] = $engine->price_1 + $alternator->price_1;
     if ($engine_alternator->power < $generators['kVA']) {
         $generators['kVA'] = $engine_alternator->power;
     }
     if ($engine->days > $alternator->days) {
         $generators['days'] = $engine->days;
     } else {
         $generators['days'] = $alternator->days;
     }
     $generators['name'] = 'G50-' . round($generators['kVA']) . $engine->manufacturer->code . $alternator->manufacturer->code . 'BA';
     //echo '<pre>';print_r($generators);exit;
     $data['generators'] = $generators;
     $this->view('generator', $data);
 }
开发者ID:lekhang,项目名称:gonline,代码行数:34,代码来源:Product.php


示例9: index

 public function index($slug, $sort = 'id', $dir = "ASC", $page = 0)
 {
     \CI::lang()->load('categories');
     //define the URL for pagination
     $pagination_base_url = site_url('category/' . $slug . '/' . $sort . '/' . $dir);
     //how many products do we want to display per page?
     //this is configurable from the admin settings page.
     $per_page = config_item('products_per_page');
     //grab the categories
     $categories = \CI::Categories()->get($slug, $sort, $dir, $page, $per_page);
     //no category? show 404
     if (!$categories) {
         throw_404();
     }
     //load up the pagination library
     \CI::load()->library('pagination');
     $config['base_url'] = $pagination_base_url;
     $config['uri_segment'] = 5;
     $config['per_page'] = $per_page;
     $config['num_links'] = 3;
     $config['total_rows'] = $categories['total_products'];
     \CI::pagination()->initialize($config);
     //load the view
     $this->view('categories/category', $categories);
 }
开发者ID:haouach,项目名称:GoCart3,代码行数:25,代码来源:Category.php


示例10: __construct

 /**
  *
  */
 function __construct()
 {
     date_default_timezone_set('Asia/Calcutta');
     $ci = CI::get_instance();
     $ci->load->Model('Email_settings/Mdl_email_settings');
     //load email settings model
     $smtp = $ci->Mdl_email_settings->toArray();
     //get object valeus in array
     $config = array();
     $config['protocol'] = 'smtp';
     $config['mailpath'] = '/usr/sbin/sendmail';
     $config['smtp_host'] = $smtp['smtp_host'];
     $config['smtp_pass'] = $smtp['smtp_pass'];
     // email's password    - set smtp values
     $config['smtp_user'] = $smtp['smtp_user'];
     $config['smtp_port'] = $smtp['smtp_port'];
     //gmail port 465 (ssl) and 587 (TSL) required
     $config['smtp_timeout'] = 10;
     //smtp timeout in seconds
     $config['wordwrap'] = TRUE;
     $config['wrapchars'] = 76;
     $config['mailtype'] = 'html';
     $config['charset'] = 'utf-8';
     $config['validate'] = TRUE;
     $config['priority'] = 3;
     $config['crif'] = "\r\n";
     $config['newline'] = "\r\n";
     $config['bcc_batch_mode'] = TRUE;
     $config['bcc_batch_size'] = 200;
     parent::__construct($config);
 }
开发者ID:nkscoder,项目名称:chawri,代码行数:34,代码来源:MY_Email.php


示例11: get_visits_by_url

 function get_visits_by_url($url, $start_time = false)
 {
     global $cms_db_tables;
     $idsite = $this->site_id();
     $table = $cms_db_tables['table_log_action'];
     $cache_group = 'global/stats';
     $q = "SELECT * FROM {$table} WHERE name = '{$url}' ";
     $q = CI::model('core')->dbQuery($q, __FUNCTION__ . md5($q), $cache_group, '- 5 minutes');
     if (!empty($q)) {
         $q = $q[0];
         $idaction = $q['idaction'];
         $table2 = $cms_db_tables['table_log_link_visit_action'];
         if ($start_time == false) {
             $start_time = strtotime("4 weeks ago");
             $start_time = date("Y-m-d H:i:s", $start_time);
         } else {
             $start_time = strtotime($start_time);
             $start_time = date("Y-m-d H:i:s", $start_time);
         }
         $q = " SELECT    idaction_name as id,  \n              COUNT(idlink_va) as views,  \n              COUNT(DISTINCT idvisitor) as visits,  \n              COUNT(IF(idaction_url_ref=0, 1, null)) as entry,  \n              log_action.name as page  \n              FROM {$table2}, {$table}  \n              WHERE {$table2}.idsite={$idsite}  \n              \n              and idaction_url = {$idaction} \n              \n              AND {$table2}.idaction_name = {$table}.idaction  \n              AND server_time >='{$start_time}'\n              \n              ";
         $q = " SELECT    idaction_name as id,  \n              COUNT(idlink_va) as views \n              \n              FROM {$table2}  \n              WHERE \n              \n              idaction_url = {$idaction} \n              \n            \n              AND server_time >='{$start_time}'\n              \n              ";
         $q = CI::model('core')->dbQuery($q, __FUNCTION__ . md5($q), $cache_group, '- 5 minutes');
         return intval($q[0]["views"]);
     } else {
         return 0;
     }
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:27,代码来源:stats_model.php


示例12: load

 function load()
 {
     $plugin_name = $this->uri->segment(4);
     $this->template['functionName'] = strtolower(__FUNCTION__);
     $this->template['pluginName'] = $plugin_name;
     $this->load->vars($this->template);
     $layout = CI::view('admin/layout', true, true);
     $primarycontent = '';
     $secondarycontent = '';
     $plugindata = CI::model('core')->plugins_getPluginConfig($plugin_name);
     //
     //print  PLUGINS_DIRNAME . $dirname .$plugin_name.'/'.$plugindata['plugin_admin_dir']. '/controller.php' ;
     if (is_file(PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/controller.php') == true) {
         $firecms = get_instance();
         define('THIS_PLUGIN_URL', site_url('admin/plugins/load') . '/' . $plugin_name . '/');
         define('THIS_PLUGIN_DIRNAME', PLUGINS_DIRNAME . $dirname . $plugin_name . '/');
         define('THIS_PLUGIN_DIRNAME_ADMIN', PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/');
         require_once PLUGINS_DIRNAME . $dirname . $plugin_name . '/' . $plugindata['plugin_admin_dir'] . '/controller.php';
     }
     //$primarycontent = CI::view ( 'admin/comments/index', true, true );
     //$secondarycontent = CI::view ( 'admin/content/sidebar', true, true );
     $layout = str_ireplace('{primarycontent}', $primarycontent, $layout);
     $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout);
     //CI::view('welcome_message');
     CI::library('output')->set_output($layout);
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:26,代码来源:plugins.php


示例13: edit

 function edit()
 {
     $this->template['functionName'] = strtolower(__FUNCTION__);
     $this->load->vars($this->template);
     if ($_POST) {
         $save = $this->cacaomail_model->saveMailAccounts($_POST);
         redirect('mailaccounts');
     }
     $segs = $this->uri->segment_array();
     $the_id = false;
     foreach ($segs as $segment) {
         if (stristr($segment, 'id:') == true) {
             $the_id = $segment;
             $the_id = substr($the_id, 3, strlen($the_id));
         }
     }
     if (intval($the_id) != 0) {
         $form_values = $this->cacaomail_model->getMailAccounts(array('id' => $the_id), 1);
         $form_values = $form_values[0];
         $this->template['form_values'] = $form_values;
     } else {
         //$this->template ['form_values'] = false;
     }
     $this->template['form_values']['account_groups'] = $this->cacaomail_model->getMailAccountsGroups();
     $this->load->vars($this->template);
     $layout = CI::view('layout', true, true);
     $primarycontent = '';
     $secondarycontent = '';
     $primarycontent = CI::view('mailaccounts/edit', true, true);
     $secondarycontent = CI::view('mailaccounts/sidebar', true, true);
     $layout = str_ireplace('{primarycontent}', $primarycontent, $layout);
     $layout = str_ireplace('{secondarycontent}', $secondarycontent, $layout);
     //CI::view('welcome_message');
     CI::library('output')->set_output($layout);
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:35,代码来源:mailaccounts.php


示例14: lap_dat

function lap_dat()
{
    \CI::load()->model(['Materials']);
    $tmp = \CI::Materials()->getMaterials();
    echo '<pre>';
    print_r($tmp);
    exit;
}
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:8,代码来源:calculator_helper.php


示例15: mediaDelete

 function mediaDelete()
 {
     $id = $_POST['id'];
     if (intval($id) != 0) {
         CI::model('core')->mediaDelete($id);
     }
     exit;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:8,代码来源:core.php


示例16: shortcode

 public function shortcode($slug = false, $perPage = false)
 {
     if (!$perPage) {
         $perPage = config_item('products_per_page');
     }
     $products = \CI::Categories()->get($slug, 'id', 'ASC', 0, $perPage);
     return $this->partial('categories/products', $products);
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:8,代码来源:Category.php


示例17: rates

 public function rates()
 {
     $settings = \CI::Settings()->get_settings('FlatRate');
     if ($settings['enabled'] && $settings['enabled'] > 0) {
         return ['Flat Rate' => $settings['rate']];
     } else {
         return [];
     }
 }
开发者ID:haouach,项目名称:GoCart3,代码行数:9,代码来源:FlatRate.php


示例18: getVideos

 function getVideos($criteria = false)
 {
     $table = TABLE_PREFIX . 'masterdebate_videos';
     $q = " SELECT * FROM {$table} order by id DESC ";
     //print $q ;
     $query = CI::db()->query($q);
     $query = $query->result_array();
     return $query;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:9,代码来源:masterdebate_model.php


示例19: delete

 function delete()
 {
     $id = $_POST['id'];
     if (intval($id) == 0) {
         exit('id');
     } else {
         CI::model('comments')->commentsDeleteById($id);
     }
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:9,代码来源:comments.php


示例20: rates

 public function rates()
 {
     $settings = \CI::Settings()->get_settings('FlatRate');
     if (isset($settings['enabled']) && (bool) $settings['enabled']) {
         return ['фирма Спиди' => $settings['rate']];
     } else {
         return [];
     }
 }
开发者ID:vandona,项目名称:v3,代码行数:9,代码来源:FlatRate.php



注:本文中的CI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CIBlock类代码示例发布时间:2022-05-23
下一篇:
PHP CHttpSession类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap