The above is the output timestamp in AJAX. I don’t know how to do it, so I tried to convert it in PHP
But why can’t I rotate like this in the model or C? When output, this array becomes this field, and other fields are lost
I found out from the answer of an expert above that you can use the mysql statement to convert the addtime into time format in the linked list. But in TP, if you add that kind of conversion statement after the field field, will an error be reported? Does anyone know how to write without getting an error?
I know I am a bit mentally retarded with this question, so I humbly seek advice from an expert, thank you
The above is the output timestamp in AJAX. I don’t know how to do it, so I tried to convert it in PHP
But why can’t I rotate like this in the model or C? When output, this array becomes this field, and other fields are lost
I found out from the answer of an expert above that you can use the mysql statement to convert the addtime into time format in the linked list. But in TP, if you add that kind of conversion statement after the field field, will an error be reported? Does anyone know how to write without getting an error?
I know I am a bit mentally retarded with this question, so I humbly seek advice from an expert, thank you
<code>// zero padding, 补0 function zp(n){ return n<10?['0',n].join(''):n; } // ts为13位的时间戮(ms), 如果是秒,乖1000 function ts_date(ts, d){ d = new Date(+ts); // +号, 若为字符串转为数字 return [d.getFullYear(), zp(d.getMonth()+1), zp(d.getDate())].join("-")+" "+[zp(d.getHours()), zp(d.getMinutes()), zp(d.getSeconds())].join(":"); }</code>
<code>+ ts_date(v.addtime) + '</span>';</code>
$pinluns is a two-dimensional array. You can print it and take a look. To format the timestamp, you can loop $pinluns to do it, or you can use MySQL data formatting when checking the database without using PHP. Formatted.
It is recommended to turn the handlebar on the front.
But this won’t work. The array queried by select is a two-dimensional array, and you need to reassemble the data.
<code>->find()才是查询一条数据; 如果->select() 那就是$pinluns[0]['addtime'];</code>
The selected result is a two-dimensional array. You need to use foreach to traverse the array and add addtime
moment