Lapas redirect

Ja nepieciešams pārsūtīt uz citu lapu tās ielādes laikā, var izmantot php funkciju:

<?
$URL="http://localhost/…";
header ("Location: $URL");

?>

Taču gadījumos, kad jāaizsūta uz citurieni izpildāmā koda vidus daļā(pie noteiktiem notikumiem), nekas neatliek kā izsaukt javascript:

echo “<script language=\”javascript\”>”;
echo “window.location = \”http://localhost/…”;
echo “</script>”;

Tas gan nenostrādās, ja pārlūkā būs atslēgts javascript

Related posts:

  1. HTML REDIRECT SEO
  2. PHP funkcija, kas atgriež tekošo URLI
This entry was posted in How to, Interesanti, PHP, Web and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>