すでに動的ページを作成でき、機能していますが、ランディング ページの読み込みが非常に遅くなります。
私は本当に助けが欲しいです。以下は、私のサイトがどのように機能するかです。
のリンクから始めましょうhttp://example.com/search.php
:
<?php
session_start();
//(pretend there is code here that gets, decodes, and displays data from an api)
$title = $titleFromApi;
$a = $dataFromApi;
$_SESSION['storeTitle'] = $title; // stores 'title' in a session variable
$_SESSION['store_a'] = $a; // stores 'a' in a session variable
echo '<a href="http://example.com/'. $a .'/' . $title .'> ' . $title . '</a>';
// the line above is a clickable link that will take them to the landing page
?>
ランディング ページ ( http://example.com/$a/$title
) は次のとおりです。
<?php
session_start();
$al = $_SESSION['store_a']; // stores session variable in new variable 'al'
$getter = 'http://api.somewebsite.com/dev/' . $al . '/get_these_variables';
// the line above gets data from an api using variable 'al'
// (pretend that there is code here that decodes the data)
// the code below displays the data retrieved from the api
foreach($data as $entry){
echo '
<div>
' . $entry['decoded_data_1']
. '
</div>
<div>
' . $entry['decoded_data_2'] // and so on
. '
</div>
'; // ends echo
}
?>
今日、セッションについて学んだばかりです (セッションのほうが速くなると思いました)。以前は、search.php からアドレス バーにデータを送信し、それをランディング ページで読み取って変数を引き継いでいました (うんざりですが、私は php と開発全般に非常に慣れていません)。ランディング ページのページ読み込み速度は変更されていません。