Skip to content

Instantly share code, notes, and snippets.

View pzzrudlf's full-sized avatar
💭
I may be slow to respond.

pzzrudlf pzzrudlf

💭
I may be slow to respond.
View GitHub Profile
1、You can get the last inserted ID like this:
Yii::app()->db->getLastInsertId();
2、If $model->id wouldn't work then use Yii::app()->db->getLastInsertId() or getPrimaryKey()
3、If your goal is to get the id that was assigned to the model that you just saved,
then after you do $model->save(), simply do $model->id to get it back.
4、
you can also get the last inserted id of another model.
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination'=>[
'pageSize'=>10,
]
])
$query -> andWhere('url is not null');
$query -> andWhere(['parent_id'=>123]);
<?php $model->icon = $iconer;?>//此处是将$iconer变量的值传到icon成员变量里,在item回调函数里,用来判断是否是默认值(判断$checked是否是true)
<label class = 'control-label'><?=Yii::t('app', 'Icon');?>: </label><?= MyHtml::activeRadioList($model, 'icon', $i_data,['class'=>'radio_icon', 'encode' => 0,
'item' => function ($index, $label, $name, $checked, $value){
if ($checked) {//此处对应于第一行
return Html::radio($name, ['checked'=>true],['value'=>$value,'label'=>$label]);
}
return Html::radio($name, $checked,['value'=>$value,'label'=>$label]);
}])?>
http://www.cnblogs.com/rainman/p/3837671.html
http://www.cnblogs.com/leezhxing/p/4472155.html
$('#container_chart').highcharts({
chart: {
type: type,
zoomType: 'x'
},
title: {
text: 'data_title'
},
xAxis: {
http://edbiji.com/
http://www.meadow.se/wordpress/refreshing-data-in-jquery-datatables/
https://segmentfault.com/a/1190000000687844
http://www.kaufmann.no/roland/dvorak/winxp.html
http://0x1.im/blog/php/php-cs-fixer.html
/**
* recursive function in order to convert a multiple dimensions array to a single dimension array
* @param array $array
* @param array $res
* @return $res
* @auther pzzrudlf <pzzrudlf@gmail.com>
*/
public function convertToSingleArray($array, &$res=[])
{
foreach ($array as $key => $value) {
<table id="__01" class="table-responsive" border="0" cellpadding="0" cellspacing="0">
<?php
$i = 0;
$content = '';
foreach ($indexdata as $key => $value) {
if ($i%2 == 0){//每7列换一行,配合下面的判断使用
$content .= '<tr>';
}
$id = $value['id'];
<table id="__01" class="table-responsive" border="0" cellpadding="0" cellspacing="0">
<?php
$i = 0;
$content = '';
foreach ($indexdata as $key => $value) {
if ($i%2 == 0){//每7列换一行,配合下面的判断使用
$content .= '<tr>';
}
$id = $value['id'];
change the declaration way of the specific function that you defined
<script>
window.onload = function(){
//there may occur some errors. 'referenceError:exeSelect() is not defined'
function exeSelect(param)
{
console.log(param);
}