【问题标题】:node : send value from on page to another?节点:将页面上的值发送到另一个?
【发布时间】:2014-06-03 18:48:50
【问题描述】:

在 php 中,我知道将值发送到另一个页面的会话和 url。例如

public/ 
    index.php
         profile/
            editProfile.php
            viewprofile.php

在 index php 中,我想调用 viewprofile.php 并从 index.php 发送值,以便 viewprofile.php 可以接收该值。我使用 ($_GET / $_REQUEST / $_POST) 所以我成功从索引中获取值。 php

关于我上面的描述,我想问一下,我是如何实现的,使用 nodejs 将值从一个页面发送到另一个页面(没有快递)?

谢谢

【问题讨论】:

    标签: javascript php html node.js


    【解决方案1】:

    尝试使用 JADE 或 DUST 等模板语言。例如, 在您的 routehandler 函数中,您可以按如下方式调用灰尘文件:

    var user=request.session.name;

    response.render('viewprofile',{user:user});

    其中 viewprofile 是一个灰尘文件,您可以在其中以 {user} 身份访问用户变量。

    查看https://github.com/linkedin/dustjs/wiki/Dust-Tutorial 了解 DUST 教程

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-26
      • 2020-08-16
      • 1970-01-01
      相关资源
      最近更新 更多