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);
 }
Example #2
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;
 }