1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * @param string $address 地址
- * @return array
- */
- /**
- * 秒转换为天
- */
- function get_stay_time($remain_time, $is_hour = 1, $is_minutes = 1)
- {
- $day = floor($remain_time / (3600*24));
- $day = $day > 0 ? $day.'天' : '';
- $hour = floor(($remain_time % (3600*24)) / 3600);
- $hour = $hour > 0 ? $hour.'小时' : '';
- if($is_hour && $is_minutes) {
- $minutes = floor((($remain_time % (3600*24)) % 3600) / 60);
- $minutes = $minutes > 0 ? $minutes.'分钟' : '';
- return $day.$hour.$minutes;
- }
- if($hour) {
- return $day.$hour;
- }
- return $day;
- }
- //获取全图片地址 $image_data
- function image_path($image_data){
- if(empty($image_data)){
- return $image_data;
- }
- if (strpos($image_data,'|')!==false){
- $image_res = explode('|',$image_data);
- }elseif(strpos($image_data,',')!==false){
- $image_res = explode(',',$image_data);
- }else{
- $image_res = array($image_data);
- }
- return $image_res;
- }
- //通过user_id判断是用户还是媒体(返回1:用户 2:媒体)
- function user_type($user_id){
- $type = 1;
- if($user_id < 500){
- $type = 2;
- }
- return $type;
- }
|