Example #1
0
 public static function Log($type, $stack, $obj, $addinfo)
 {
     $stackarr = [];
     foreach ($stack as $index => $item) {
         if ($index == 0) {
             continue;
         }
         if (!isset($item['class'])) {
             continue;
         }
         if (!isset($item['function'])) {
             continue;
         }
         $stackarr[] = $item['class'] . '->' . $item['function'] . '.' . (isset($item['line']) ? $item['line'] : '0');
     }
     $stackstrr = implode('|', $stackarr);
     $data = StringUtitly::FormatTimestamp(time());
     $data .= "\t";
     $data .= $type;
     $data .= "/";
     $data .= $stackstrr;
     $data .= "\t";
     $data .= $addinfo;
     $data .= "\t";
     $data .= json_encode(var_export($obj, TRUE));
     return self::WriteLog($data);
 }
 public static function isDateTimeInRegion($dt1, $begin, $end)
 {
     $dt1 = intval($dt1);
     $begin = intval($begin);
     $end = intval($end);
     if (\StringUtitly::CompareDateTime($dt1, $end) == \StringUtitly::DATETIME_AFTER) {
         return false;
     }
     if (\StringUtitly::CompareDateTime($dt1, $begin) == \StringUtitly::DATETIME_BEFORE) {
         return false;
     }
     return true;
 }
Example #3
0
 /**
  * @param $InfoBean UploadFileInfoBean
  * @param $path
  * @param bool $Rename
  * @return bool |string
  */
 public static function SaveUploadFile($InfoBean, $path, $Rename = true, $DirPerMon = null)
 {
     if ($InfoBean == null) {
         return false;
     }
     if (!$InfoBean instanceof UploadFileInfoBean) {
         return false;
     }
     $filename = $InfoBean->getFileNameNoExt() . '.' . $InfoBean->getFielExt();
     if ($Rename) {
         $filename = StringUtitly::FormatTimestamp(time(), 'YmdHis') . mt_rand(1000, 9999) . '.' . $InfoBean->getFielExt();
     }
     if (!empty($DirPerMon)) {
         $path .= '/' . $DirPerMon;
         if (!is_dir($path)) {
             @mkdir($path, 0777);
         }
     }
     $path .= '/' . $filename;
     if (@move_uploaded_file($InfoBean->getTmpName(), $path) == false) {
         return false;
     }
     return $filename;
 }
Example #4
0
 public function GetMyinfo()
 {
     $this->getHeader = 0;
     $html = $this->vget("https://mp.weixin.qq.com/cgi-bin/settingpage?t=setting/index&action=index&token=" . $this->token . "&lang=zh_CN");
     $html = StringUtitly::SubString($html, 'class="account_setting_area"', '</ul>');
     $rz = preg_match_all('/<li class="account_setting_item">.*?<h4>(.*?)<\\/h4>.*?<div class="meta_content">(.*?)<\\/div>.*?<\\/li>/is', $html, $matches);
     if ($rz === false) {
         return false;
     }
     $attrs = [];
     foreach ($matches[1] as $index => $item) {
         if ($item == '头像') {
             $img = $matches[2][$index];
             preg_match('/src="(.*?)"/is', $img, $ma);
             $attrs[$item] = 'https://mp.weixin.qq.com' . $ma[1];
         } else {
             $attrs[$item] = StringUtitly::RemoveHtmlTag($matches[2][$index]);
         }
     }
     return $attrs;
 }