123456789101112131415161718192021222324252627282930313233 |
- <?php
- /**
- * Created by PhpStorm.
- * User: guanxl
- * Date: 2018/6/5
- * Time: 16:32
- */
-
- namespace App\Services;
-
-
- use Illuminate\Support\Facades\Log;
-
- class ErrorMessageService
- {
-
- public static function redirect($message=""){
- Log::info("User agent");
- Log::info($_SERVER['HTTP_USER_AGENT']);
- $url = env("ERROR_MESSAGE_URL");
- if($message) $url.="?error=".$message;
- header("location: ".$url);
- die;
- }
-
- public static function forward($message=""){
- Log::info("User agent");
- Log::info($_SERVER['HTTP_USER_AGENT']);
- $url = env("ERROR_MESSAGE_URL");
- if($message) $url.="?error=".$message;
- die(json_encode(["error"=>302,"message"=>$message,"redirect"=>$url]));
- }
- }
|