编程语言
首页 > 编程语言> > javascript-是否有可能将整个表格从具有其内容的URL复制到另一个页面?

javascript-是否有可能将整个表格从具有其内容的URL复制到另一个页面?

作者:互联网

我有一个WP插件生成的自定义页面,其中的表具有< table class =“ specs-product”>班级名称.我知道它是如何生成自定义URL的,因此我可以每次访问它,但是我也想仅在模板页面上显示整个表格.是否有任何复制粘贴之类的解决方案,或更难?

解决方法:

用卷毛解决方案:

(下载:SimpleHtmlDomParser)

    include('simple_html_dom.php');

    $ch1 = curl_init('FirstPageUrl');
    curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch1, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT ,0);
    curl_setopt($ch1, CURLOPT_TIMEOUT, 10);
    $FirstPage = curl_exec($ch1);
    curl_close($ch1);

    $FirstPageHtml = str_get_html($FirstPage);
    $Table = $FirstPageHtml->find('table[class=specs-product]');
    echo $Table;

Simple Dom Parser的解决方案:

(下载:SimpleHtmlDomParser)

    include('simple_html_dom.php');

    $html = file_get_html('FirstPageUrl',false);
    $Table = $html->find('table[class=specs-product]');
    echo $Table;

PHP解决方案:

将您的表转换为php变量,并将其传递给具有会话的下一页.

How to turn a Div into a Varaible?

What is a Session?

标签:html-table,wordpress,javascript,php,jquery
来源: https://codeday.me/bug/20191110/2013878.html