簡體   English   中英

使用php從網站獲取文本文件的字符串

[英]get string of a text file from a website with php

我有一個txt文件,想閱讀。 它只包含一個詞。

我想將其用作sql表名稱的字符串。

$f = file_get_contents("http://...../...../..../address.txt");



 $sql = "insert into " + $f + "(x,y) values ('$x','$y')";

不幸的是它不起作用..請幫助我!

謝謝。

嘗試使用“。” 而不是使用“ +”進行連接。 像這樣:

$sql = "insert into " . $f . "(x,y) values ('$x','$y')";

您不能在PHP中使用+組合字符串。 那是一個javascript(也是其他語言)術語

更正:

$f = file_get_contents("http://...../...../..../address.txt");

$sql = "insert into " . $f . "(x,y) values ('$x','$y')";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM