私はjsonに非常に慣れておらず、この問題に約1週間取り組んできました。
phpを使用してアカウントのリストからツイートを取得し、それらを.txtファイルに保存しました
$cache = dirname(__FILE__) . '/../cache/twitter-json.txt';
$data = file_get_contents('http://api.twitter.com/1/lists/statuses.json? slug=widget&owner_screen_name=webcodepro&count=1&page=1&per_page=8&include_rts=true&include_entities=true');
$cachefile = fopen($cache, 'wb');
fwrite($cachefile,utf8_encode($data));
fclose($cachefile);
?>
アーキテクトがフロントエンドページを構造化する方法は、json値(.txtファイルにあるもの)を.jsファイルのjson変数に格納してレンダリングする必要があるということです。
編集:それはに変更されました
$cache =_ _DIR__.'/cached.txt';
$data = file_get_contents('http://api.twitter.com/1/lists/statuses.json? slug=widget&owner_screen_name=webcodepro&count=1&page=1&per_page=8&include_rts=true&include_entities=true');
file_put_contents($cache, $data);
ファイルは空になります。何が問題なのか知っていますか?
.txtファイルの内容を.jsファイルのjson変数に保存することは可能ですか?