0
、私は以下のルートを持っていると私は生産(nginxの)に自分のコードを押すと、それは、ページは私のweb.phpファイルで
Route::get('users/xml', function() {
$merchants = DB::table('merchants')->where('published', '1')->get();
$xml = new XMLWriter();
$xml->openMemory();
$xml->startDocument();
$xml->startElement('markers');
foreach($merchants as $merchant) {
$xml->startElement('marker');
$xml->writeAttribute('id', $merchant->id);
$xml->writeAttribute('name', $merchant->merchant_code);
$xml->writeAttribute('address', $merchant->address);
$xml->writeAttribute('lat', $merchant->lat);
$xml->writeAttribute('lng', $merchant->lng);
$xml->endElement();
}
$xml->endElement();
$xml->endDocument();
$content = $xml->outputMemory();
/*File::put(storage_path().'/file.xml', $content);*/
return response($content)->header('Content-Type', 'text/xml');
});
しかし正常に動作し、ページではありません見つかりました。
見つからない唯一のページですか?ホームページには '/'が表示されていますか? – qasimalbaqali
すべてのロジックとコードを 'route'ファイルに入れるのは良い方法ではありません。 –
あなたのロジックは、ルートフォルダ/ファイルではなくコントローラに属します。 – Option