debug_aliyun_response.php 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require __DIR__.'/vendor/autoload.php';
  3. $app = require_once __DIR__.'/bootstrap/app.php';
  4. $kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
  5. $kernel->bootstrap();
  6. // Get the latest log entry with Aliyun Data Preview
  7. $logFile = storage_path('logs/laravel.log');
  8. $content = file_get_contents($logFile);
  9. // Find the last "Aliyun Data Preview" entry
  10. preg_match_all('/Aliyun Data Preview.*?{\"data\":\"(.*?)\"}/', $content, $matches);
  11. if (!empty($matches[1])) {
  12. $lastMatch = end($matches[1]);
  13. // Unescape the JSON string
  14. $jsonStr = str_replace('\\"', '"', $lastMatch);
  15. $jsonStr = str_replace('\\\\', '\\', $jsonStr);
  16. $data = json_decode($jsonStr, true);
  17. if (isset($data['page_list'][0]['subject_list'][0])) {
  18. echo "First subject structure:\n";
  19. print_r($data['page_list'][0]['subject_list'][0]);
  20. } else {
  21. echo "No subject_list found\n";
  22. echo "Available keys in page_list[0]: " . implode(', ', array_keys($data['page_list'][0] ?? [])) . "\n";
  23. }
  24. }