Exemplo n.º 1
0
 public function actionDemo()
 {
     $headers = get_headers('http://www.liangshan-online.com/public/uploadfiles/86991333899060.gif', 1);
     UtilHelper::dump($headers);
     UtilHelper::dump(date('Y-m-d H:i:s', strtotime($headers['Last-Modified'])));
     $this->render('demo');
 }
Exemplo n.º 2
0
 public function actionGetParents()
 {
     $result = array();
     $result[0] = '无';
     $type = $_GET['type'];
     if (isset($type)) {
         $channel = Channel::model()->findAll(array('condition' => 'type = :type', 'params' => array(':type' => $type)));
         foreach ($channel as $item) {
             $result[$item->id] = $item->name;
         }
     }
     UtilHelper::dump($result);
 }
Exemplo n.º 3
0
<?php

foreach ($model as $data) {
    UtilHelper::dump($data->attributes);
}
Exemplo n.º 4
0
 public function actionTest2()
 {
     require 'Zend/Search/Lucene.php';
     require 'Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php';
     Yii::import('application.helpers.search.*');
     $str = "OK";
     $analyzer = new Phpbean_Lucene_Analyzer();
     $keywords = strtolower($str);
     $stopWords = array("a", "an", "at", "the", "and", "or", "is", "am");
     $stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords);
     $analyzer = new Phpbean_Lucene_Analyzer();
     $cnStopWords = array("的");
     $analyzer->setCnStopWords($cnStopWords);
     $analyzer->addFilter($stopWordsFilter);
     $value = "this is  a test二元分词是中文分词最简单的一种算法,就是把一个句子中相邻的两个字当作一个...就是读取数据库,然后分词建立二进制格式的索引保存在文件中";
     $analyzer->setInput($value, "utf-8");
     $position = 0;
     $tokenCounter = 0;
     while (($token = $analyzer->nextToken()) !== null) {
         $tokenCounter++;
         $tokens[] = $token->getTermText();
     }
     UtilHelper::dump($tokens);
 }
Exemplo n.º 5
0
 /**
  * 
  * Get the visitors who have read this blog
  * @param int $id
  */
 public function getArticleVisitors($id)
 {
     $model = self::model()->findAll(array('condition' => 'aid = ' . $id, 'order' => 'lasttime DESC'));
     UtilHelper::dump($model);
     return $model;
 }
Exemplo n.º 6
0
<section class="span-19">
<h4 class="pageTitle">服务器参数</h4>

<?php 
$log = new CFileLogRoute();
UtilHelper::dump($log->getLogFile());
?>
<ul id="sys-info">
	<li>系统类型及版本号:<?php 
echo php_uname();
?>
</li>
	<li>服务器解译引擎:<?php 
echo $_SERVER['SERVER_SOFTWARE'];
?>
</li>
	<li>域名:<?php 
echo $_SERVER["HTTP_HOST"];
?>
</li>
	<li>Zend 版本:<?php 
echo zend_version();
?>
</li>
	<li>PHP安装路径:<?php 
echo DEFAULT_INCLUDE_PATH;
?>
</li>
	<li>可用扩展:<?php 
var_dump(extension_loaded('id3'));
?>
Exemplo n.º 7
0
 public function actionTT()
 {
     UtilHelper::dump($_REQUEST);
 }
Exemplo n.º 8
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $model = Advertisement::model()->findAll(array('join' => '{{profile}}'));
     UtilHelper::dump($model);
     $dataProvider = new CActiveDataProvider('Job');
     $this->render('index', array('dataProvider' => $dataProvider));
 }
Exemplo n.º 9
0
{
    $val = $prefix . '-' . $val;
}
$test = 'Hello everyone';
$arr = explode(' ', $test);
array_walk($arr, 'addPrefix', 'light');
UtilHelper::dump($arr);
$id = 1;
$cname = 'light';
echo $html;
//替换参数
$html = str_replace(':id', ':' . $id, $html);
//替换正则
$pattern = '/class="(.*)"?/i';
preg_match_all($pattern, $html, $matches);
UtilHelper::dump($matches);
$result = '';
foreach ($matches[1] as $item) {
    $result .= '.' . $item . "{\n}";
}
echo $result;
die;
//替换匹配内容
$html = preg_replace($pattern, 'class="' . $cname . '-\\1"', $html);
echo $html;
//为匹配出来的内容添加首尾的双引号“""”
$html = '$html= "' . $html . '";';
//把字符串转化为可以执行的代码,得到需要的处理结果$html;
//       eval($html);
//输出处理结果
echo $html;
Exemplo n.º 10
0
<ul id="destination" style="display: none">
  <li data-id="blood">Blood orange</li>
  <li data-id="pers">Persian orange</li>
  <li data-id="valen">Valencia orange</li>
</ul>
	
	</article>
	<article class="span-1" style="border-left:1px solid grey;border-right:1px solid grey;">
	&nbsp;
	</article>
	
	
	
	<article class="span-7">
		<h5>在</h5>
		<?php 
$session = Yii::app()->getSession()->getSessionId();
UtilHelper::dump($session);
?>
	
	</article>
</section>

<?php 
$this->widget('ext.weather.WeatherWidget');
$this->widget('ext.isotope.IsotopeWidget', array('id' => '.items', 'layoutMode' => 'masonry'));
?>



Exemplo n.º 11
0
 public function actionCreateRegion()
 {
     $todo = array();
     $str = "天津市:市辖区 和平区 河东区 河西区 南开区 河北区 红桥区 塘沽区 汉沽区 大港区 东丽区 西青区 津南区 北辰区 武清区 宝坻区 宁河县 静海县 蓟 县 ";
     $str = str_replace(' ', '', $str);
     $dd = explode(':', $str);
     $todo['dd'] = $dd[0];
     $todo['tt'] = explode(' ', $dd[1]);
     //		UtilHelper::dump($todo);
     $result = array();
     $file = file('./public/datas/region.txt');
     $i = 0;
     foreach ($file as $province) {
         $province = str_replace("\r\n", '', $province);
         $pos = strpos($province, ': ');
         if ($pos === false) {
             $region1 = $province;
         } else {
             $str = str_replace(' ', '', $province);
             $mv = explode(': ', $str);
             $county = explode(' ', $mv[1]);
             $result[$region1][$mv[0]] = $county;
         }
     }
     $return = array();
     $id = 1;
     $pid = 0;
     foreach ($result as $key => $item) {
         $return[] = array('id' => $id, 'pid' => $pid, 'region' => $key);
         $pid1 = $id;
         $id++;
         foreach ($item as $key2 => $item2) {
             $return[] = array('id' => $id, 'pid' => $pid1, 'region' => $key2);
             $pid2 = $id;
             $id++;
             foreach ($item2 as $item3) {
                 if ($item3 !== '') {
                     $return[] = array('id' => $id, 'pid' => $pid2, 'region' => $item3);
                     $id++;
                 }
             }
         }
     }
     $fp = fopen('./public/region.txt', 'w+');
     //格式化记录到新文件
     foreach ($return as $todo) {
         $content = '|' . $todo['id'] . '|' . $todo['region'] . "|1|" . $todo['pid'] . "|0" . "\r\n";
         fwrite($fp, $content);
         $region = new Region();
         $region->id = $todo['id'];
         $region->region = $todo['region'];
         $region->pid = $todo['pid'];
         $region->uid = 1;
         if (!$region->save()) {
             UtilHelper::writeToFile(CHtml::errorSummary($model));
         }
     }
     fclose($fp);
     UtilHelper::dump($return);
 }