dqhmtpuy94946 2012-03-02 23:59
浏览 351

如何将php数据传输到html文件?

After I login the user, I want to have a separate html page (a front page) that says "welcome, (user)." I tried to use cookies and I now know this wont work. So how would i go about doing this?

Here is my code (in my sigin script):

header('Location: frontpage.html');

In frontpage.html, I want to use some of the data from the sigin script.

  • 写回答

3条回答 默认 最新

  • doucuo4413 2012-03-03 00:03
    关注

    This is controlled by the $_SESSION array. When your user logs in, you should set some $_SESSION variables to whatever values you want (say, one variable which will let you know the user is logged in, another with their user name, another with their permissions, etc.).

    Then just echo the $_SESSION variable with the relevant user name to the user:

    echo 'Welcome, ' . $_SESSION['username'] . '.';
    

    The PHP manual has extensive information on sessions: http://il2.php.net/manual/en/intro.session.php

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?