我有源代码:
一个。
$this->eArticle["product_link"] = 'http://afamily.vn/doi-song/lop-hoc-toa-tau-day-nham-mat-ve-obama-khien-tre-thich-me-20150530074455878.chn';
print file_get_contents($this->eArticle["product_link"]);
和
乙
print file_get_contents('http://afamily.vn/doi-song/lop-hoc-toa-tau-day-nham-mat-ve-obama-khien-tre-thich-me-20150530074455878.chn');
在A中,结果返回NULL(screen haven't text
)
在B中,结果显示网站http://afamily.vn/doi-song/lop-hoc-toa-tau-day-nham-mat-ve-obama-khien-tre-thich-me-20150530074455878.chn
为什么?如何解决?谢谢!
答案 0 :(得分:1)
我很确定你做了什么,但是
您可以尝试将其存储在变量中,功能为file_get_contents()
而不是file_get_content()
,注意 " s" 强>你错过了
$this->eArticle["product_link"] = 'http://afamily.vn/doi-song/lop-hoc-toa-tau-day-nham-mat-ve-obama-khien-tre-thich-me-20150530074455878.chn';
$website_link = trim($this->eArticle["product_link"]);
echo file_get_contents($website_link);
查看Docs