gpt4 book ai didi

php - 使用 simple_html_dom 在 php 中获取分区的高度

转载 作者:可可西里 更新时间:2023-10-31 23:30:18 27 4
gpt4 key购买 nike

  <div id="divReportHeader">
<div class="row-fluid">
<div class="SpanSimple" style="width: 569px; height: 26.456692913px;
margin:0px; border: 2px solid black;">
<div style="font-family: 'Times New Roman'; font-size: 26.66px;
text-align: center; vertical-align: text-top;
font-style: italic; font-weight: bold; text-decoration: none;">
Country Details
</div>
</div>
</div>
</div>

我在 php 变量 $headerHtml 中有上面的 html,我想得到分区的高度 .SpanSimple 包括 boarder-width ,margin-topmargin-bottom。我已经尝试使用 simple_html_dom 获取高度的以下代码,但它没有帮助。

$html = str_get_html($headerHtml); 
$e = $html->find("div", 2);
echo $e->height;

有什么建议或引用吗?

最佳答案

PHP 是一种服务器端语言,我怀疑您是否可以使用它来获取分区的高度。

但是,您可以使用 javascript 来做到这一点:

$(".SpanSimple").height()

关于php - 使用 simple_html_dom 在 php 中获取分区的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29775617/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com