PHP - Manual: Dom\ParentNode::querySelector
2025-10-24
(PHP 8 >= 8.4.0)
Dom\ParentNode::querySelector — Returns the first element that matches the CSS selectors
Returns the first element that matches the CSS selectors specified
in selectors.
selectors
Returns the first Dom\Element that matches
selectors. Returns null if no element matches.
Throws a DOMException with code
Dom\SYNTAX_ERR when selectors
is not a valid CSS selector string.
官方地址:https://www.php.net/manual/en/dom-parentnode.queryselector.php