onclick替换php包含的文件 [英] onclick replace php included file

查看:138
本文介绍了onclick替换php包含的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我想要做什么是可能的,但现在是。

I am not sure if what I am trying to do is possible but here it is.

我有一个标题,在标题内是一个php include for login.php

I have a header, inside that header is a php include for "login.php"

Onlogin.php是一个将用户带到forgot.php的链接。

On "login.php" is a link that takes the user to "forgot.php".

我想做的是,而不是用户被忘记.php只是刷新页面login.php包括替换为forgot.php或做某种内容切换,有点像使用iframe。

What I would like to do is, instead of the user being taken to "forgot.php" is to just refresh the page with "login.php" include replaced with "forgot.php" or do some sort of content switch out, sort of like using an Iframe.

我不想将用户带到新页面,我只想切换标题内显示的内容。

I dont want to bring the user to a new page, I just want to switch out the content displayed inside my header.

感谢您提供的任何帮助,感谢代码示例。

Thanks for any help you can provide, code samples appreciated.

推荐答案

如果你想在没有重新加载页面的情况下完成这个任务,你将需要使用AJAX。

If you are trying to accomplish this without reloading the page you will need to use AJAX.

如果你想保留login.php,你可以做一些事情喜欢:

If you want to just keep the login.php you can perhaps do something like:

<a href="login.php?p=forgot">link</a>

与php类似

<?
if ( isset($_GET['p']) && $_GET['p']=="forgot") {
    include('forgot.php');
} else {
    include('login.php');
}

这篇关于onclick替换php包含的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆