略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Dom\ParentNode::querySelector

2025-02-27

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.

参见

添加备注

用户贡献的备注

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

官方地址:https://www.php.net/manual/en/dom-parentnode.queryselector.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3