[我想使用php来使用简单的html dom刮除输入值的只读值,我一直得到空的返回值

问题描述 投票:1回答:1

我想从此输入表单内的以下代码中抓取只读值,我使用具有简单html dom的php,但始终收到空白回复。我该怎么做才能使其具有我的价值。

<input id="copy-video-embed" type="text" readonly value="<iframe src=&quot;https://www.example.com/embedframe/52285029&quot; frameborder=0 width=510 height=400 scrolling=no allowfullscreen=allowfullscreen></iframe>" class="form-control">

所以我尝试了下面的代码,但似乎不起作用

$node = $stuff->find('input[type=text]' , 0)->plaintext ;  print_r($node) ;
php html dom
1个回答
0
投票

当您使用find获取HTML的一部分时,会将属性作为类变量获取,因此可以使用hrefvalue来获取值。

$node = $stuff->find('input[type=text]' , 0)->value;

类似的东西。

https://simplehtmldom.sourceforge.io/manual.htm

这里有一些很好的例子。

© www.soinside.com 2019 - 2024. All rights reserved.