file_get_contents 变量和字符串有什么区别?
What's the difference between file_get_contents a variable and a string?
我有源代码:
A.
$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"]);
和
B.
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 中,结果 return 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
为什么?怎么修?谢谢!
我不太确定你做了什么但是
您可以尝试将其存储在变量中,函数是 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
我有源代码:
A.
$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"]);
和
B.
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 中,结果 return 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
为什么?怎么修?谢谢!
我不太确定你做了什么但是
您可以尝试将其存储在变量中,函数是 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