LogsController.php 1014 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. *
  4. * @author Mike <m@9026.com>
  5. * @version 1.0
  6. * @date 2015年10月30日
  7. *
  8. */
  9. namespace App\Http\Controllers\Admin\Base;
  10. use App\Http\Controllers\Admin\Controller;
  11. use App\Services\Base\Attachment;
  12. class LogsController extends Controller
  13. {
  14. //系统日志
  15. public function nginx() {
  16. $log_path = storage_path() . '/logs/' . "error-log" . date("Y-m-d") . ".log";
  17. if(file_exists($log_path)) {
  18. echo "<pre>" . file_get_contents($log_path) . "</pre>";
  19. }else{
  20. exit("没有错误日志");
  21. }
  22. }
  23. /**
  24. * 初始化文件上传组件
  25. */
  26. private function _uploadControl($folder, $position = 'ali')
  27. {
  28. //初始化文件上传组件
  29. $attachmentObj = new Attachment();
  30. return $attachmentObj -> initupload([
  31. 'file_types' => 'jpg|jpeg|gif|png|bmp',
  32. ], [
  33. 'position' => $position,
  34. 'folder' => $folder,
  35. ]);
  36. }
  37. }