Home  >  Article  >  Backend Development  >  search engine optimization Two ways to interact with PHP andjavascript

search engine optimization Two ways to interact with PHP andjavascript

WBOY
WBOYOriginal
2016-07-29 08:34:32926browse

During the web page production process, how to maintain interaction between the front-end page and the
back-end CGI page without refreshing the page has always been a problem. Here are two methods I use in practice.
Method 1: Interaction through Cookies. There are three files in total, namely:
index.htm, action.php, main.htm
The principle is that the front-end page main.htm and the back-end action.php are organized through the page frame
index.htm, and the action.php page Set the width to 0, which does not affect the display. action.php puts information into cookies, and main.htm realizes interaction by reading
cookies. In main.htm, you can also control the background CGI program by re-reading action.php
.
index.htm
------------------------------------------------ ------------------


Test





< noframes>

This page uses page frames, but your browser does not support it





------------------------------------------------- --------------------
action.php
------------------------- -------------------------------------
srand((double)microtime( )*1000000);
$result=rand(0,100);
setcookie("action",$result,time()+900,"/");
?>
---------- -------------------------------------------------- ---
main.htm
------------------------------------------------ ---------------------


Test


Reread Cookie


--------- -------------------------------------------------- ---
Method 2: Interact directly through parent.*.*. There are three files in total, namely:
index.htm, action.php, main.htm, of which index.htm is the same as the previous one.
The principle is to directly pass the
information through parent.rightFrame.test.current_cookie.value.
action.php
---------------------------------------------------------------
srand((double)microtime()*1000000);
$result=rand(0,100);
?>

---------------------------------------------------------------
main.htm
---------------------------------------------------------------


Test




当前参数为



重新读取Cookie


---------------------------------------------------------------  

以上就介绍了search engine optimization PHP与javascript的两种交互方式,包括了search engine optimization方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn