好吧,我希望将样式表 URL 存储在数据库中,并通过 html 标记中的变量更改样式表 href。
但是当我使用这段代码时没有任何反应:
global $theme_addresss;
global $showdetail_dbtadbirusers;
require 'displaycustomersdb.php'; /*this file store usercode in variable via session*/
$sql_changetheme = mysqli_query($link, "SELECT profile_theme FROM tusers WHERE usercodecode='{$usercodecode}'");
$sql_result_changetheme = mysqli_fetch_array($sql_changetheme);
$theme_addresss = $sql_result_changetheme['profile_theme'];
<link rel="stylesheet" href='<?php echo $theme_addresss; ?>'>
最佳答案
我找出问题所在,代码没问题。我只是把<link rel="stylesheet" href="<?php echo $theme_addresss; ?>">
进入我网站的其他页面,成功了!
关于php - 使用连接到 mysql 的 php 变量更改样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55931950/