本文整理汇总了PHP中obj::create方法的典型用法代码示例。如果您正苦于以下问题:PHP obj::create方法的具体用法?PHP obj::create怎么用?PHP obj::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obj
的用法示例。
在下文中一共展示了obj::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dir_exist
/**
* 检查目录是否存在
* @return Int
* @author weizhifeng
**/
protected function dir_exist()
{
//对当前的目录进行检查
if (isset($this->post['dir_id'])) {
$folder_id = (int) $this->post['dir_id'];
} else {
//检查站点有没有根目录,如没有则添加
$check_count = $this->kc_folder->count(array('where' => array('site_id' => 1, 'level_depth' => 1)));
if ($check_count <= 0) {
$root_folder = array('site_id' => 1, 'parent_id' => '0', 'sub_folder_ids' => '', 'name' => 'image', 'level_depth' => 1, 'date_add' => date('Y-m-d H:i:s'), 'date_upd' => date('Y-m-d H:i:s'));
$folder_id = $this->kc_folder->create($root_folder);
} else {
$root_folder = $this->kc_folder->lists(array('where' => array('site_id' => 1, 'level_depth' => 1)));
$folder_id = $root_folder[0]['id'];
}
}
// 检查目录是否存在
$folder = $this->kc_folder->get($folder_id);
if ($folder['id'] == 0) {
$this->error_msg(Kohana::lang('o_kc.folder_not_exist'));
} else {
return $folder_id;
}
}
示例2: foreach
<?php
$min_width = 250;
foreach ($statuses as $status) {
$min_width += 100;
}
$min_width = max(960, $min_width);
$header = array('project' => $project, 'report' => $report, 'meta' => $report_obj->get_meta(), 'min_width' => $min_width, 'css' => array('styles/reset.css' => 'all', 'styles/view.css' => 'all', 'styles/print.css' => 'print'), 'js' => array('js/jquery.js', 'js/highcharts.js'));
$GI->load->view('report_plugins/layout/header', $header);
?>
<?php
$stats = obj::create();
$stats->passed_count = 0;
$stats->retest_count = 0;
$stats->failed_count = 0;
$stats->untested_count = 0;
$stats->blocked_count = 0;
$stats->custom_status1_count = 0;
$stats->custom_status2_count = 0;
$stats->custom_status3_count = 0;
$stats->custom_status4_count = 0;
$stats->custom_status5_count = 0;
$stats->custom_status6_count = 0;
$stats->custom_status7_count = 0;
foreach ($runs as $r) {
$stats->passed_count += $r->passed_count;
$stats->retest_count += $r->retest_count;
$stats->failed_count += $r->failed_count;
$stats->untested_count += $r->untested_count;
$stats->blocked_count += $r->blocked_count;