TCommand.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * 监控配置中心
  4. */
  5. class TCommand extends CConsoleCommand {
  6. public function actionIndex($img=''){
  7. if(!$img) {
  8. $this->showMsg('img required');
  9. exit;
  10. }
  11. $image_array = getimagesize($img);
  12. print_r($image_array);
  13. }
  14. public function actionC($url){
  15. if(!$url) {
  16. $this->showMsg('url required');
  17. exit;
  18. }
  19. $curl = @curl_init();
  20. if ($curl) {
  21. curl_setopt($curl, CURLOPT_HEADER, 0);
  22. curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
  23. curl_setopt($curl, CURLOPT_TIMEOUT, 3);
  24. curl_setopt($curl, CURLOPT_URL, $url);
  25. curl_setopt($curl, CURLOPT_POST, 0);
  26. curl_setopt($curl, CURLOPT_HTTPHEADER, array(
  27. 'Content-Type: application/json',
  28. ));
  29. $response = curl_exec($curl);
  30. curl_close($curl);
  31. }
  32. print_r($response);
  33. }
  34. /**
  35. * 显示信息
  36. * @param $status
  37. * @param $msg
  38. */
  39. protected function showMsg($msg)
  40. {
  41. echo $msg . PHP_EOL;
  42. }
  43. }