简体   繁体   中英

php can't include muliple files

I've got two php files which have prices of products from websites and display the prices fine, but I want to include both these files on one page and it only seems to display only the first in the list. I've test both separately and they both work fine.

<?php 
include('PricePage1.php'); 
include('PricePage2.php'); 
?>

Can anyone help? I'm also using the simple_html_dom.php in each file as well

Here is what is in the PricePage1.php:

<?php
include("simple_html_dom.php");

$html = file_get_html("http://www.argos.co.uk/static/Product/partNumber/4489263.htm");

foreach($html->find('ul.product-price-data li.price') as $element)

echo
    <a href='http://www.argos.co.uk/static/Product/partNumber/4489263.htm' target='_blank'><img src='Images/argos.png'> </img>".$element->innertext()."</a></h3><br>" ;
?>

您缺少 echo 的引号,以及 'foreach' 的开头和结尾花括号。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM