php - 使用连接到 mysql 的 php 变量更改样式表

标签 php html css

好吧,我希望将样式表 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/

相关文章:

php - 在 Linux 命令行上将循环轨道嵌入到 MP3 中?

php - MySQL:选择随机条目,但偏重某些条目

html - css - 在另一个有内容的 div 上对齐 div (::after)

javascript - 具有不可点击元素的可点击 div。

html - 使用 css 和 html 上的文本向每个 LI 添加不同的图像作为按钮

php - 通过 SQL/PhpMyAdmin 在几篇文章中用 THAT 替换 THIS(句子)

php - 获取自定义 WordPress 数据库的表状态

css - 为什么一列似乎首先加载在 Wordpress 中?

html - css 在表单 block 中隐藏文本

css - LESS - 具有相同风格的多个不同类?