php - how I can get body class - Stack Overflow

admin2025-04-27  3

I was parsing a Steam profile using phpQuery and encountered a problem. To display the background gradient, I need to take the class from the body element, but when echo($pq) the body element does not have a class and, accordingly, I cannot display information about the class on my site. But when echo($file) the body element has a class, but I cannot take it with the command $theme = $file->find("body") because $file is a string. So how can I get the class of the body object?

$ch = curl_init('/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$file = curl_exec($ch);
curl_close($ch);
$pq = phpQuery::newDocument($file);

At the output I should get from echo($theme) the value "SummerTheme" or a theme like on other pages like "DefaultTheme" or "DarkModeTheme"

转载请注明原文地址:http://anycun.com/QandA/1745705178a91074.html