ConFoo 2025

Dom\ParentNode::querySelector

(PHP 8 >= 8.4.0)

Dom\ParentNode::querySelectorReturns the first element that matches the CSS selectors

说明

public Dom\ParentNode::querySelector(string $selectors): ?Dom\Element

Returns the first element that matches the CSS selectors specified in selectors.

参数

selectors
A string containing one or more CSS 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.

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top