在包含文件时收到“无法打开流”的警告

时间:2014-04-03 07:33:58

标签: php

我正在使用以下代码

include 'popularCities.php?country=';

但是我得到了警告,请帮助我

Warning: Include(PopularCities.Php?Country=): Failed To Open Stream: No Error In C:\Xampp\Htdocs\AssetFinder\Includes\Header.Php On Line 59

Warning: Include(): Failed Opening 'PopularCities.Php?Country=' For Inclusion (Include_path='.;C:\Xampp\Php\PEAR') In C:\Xampp\Htdocs\AssetFinder\Includes\Header.Php On Line 59

1 个答案:

答案 0 :(得分:1)

include 'popularCities.php?country=';

问题在于查询字符串从文件名中删除'?country='因为include()只包含文件内容所以文件名必须是popularCities.php

使用以下, include ("popularCities.php");

对于这些国家/地区,您可以设置country_id的会话或使用ajax请求分别设置国家/地区 - 城市。