php - $_SESSION 变量在第二页上不起作用
问题描述
我在第一页创建了一个会话:
<?php
$youtubeID = get_sub_field('youtube_id');
$withlastSlash = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$withoutSlash = substr_replace($withlastSlash, "", -1);
$howtoURL = $withoutSlash . "?a=" . $youtubeID;
session_start();
$_SESSION['howtovidsurl'] = $howtoURL;
?>
然后我在第二页中调用了会话变量
<?php
session_start();
echo $_SESSION['howtovidsurl'];
?>
但是在第二页上没有任何回应。
解决方案
推荐阅读
- javascript - 更改 Material-ui 中扩展父扩展面板上的扩展面板箭头颜色
- swift - 在 swift 5 中观察屏幕录制
- docker - 如何在 CRI-O 上运行的 Minikube 中加载本地 Docker 映像?
- kubernetes - 如何在 Grafana helm chart 中配置自定义 LDAP?
- java - WebTestClient 变异过滤器 java.lang.IllegalStateException:没有“WebTestClient-Request-Id”标头
- node.js - 如何使用多个 Nodejs 服务器通信
- javascript - Rails:Webpacker 4.2 在 /app/public/packs/manifest.json heroku 中找不到应用程序
- docker - yaml.parser.ParserError - 为什么它不起作用?
- laravel - 在 Laravel 中制作 Guzzle HTTP POST 请求
- javascript - 为所有请求添加动态标头