#推荐
PHP编写网站信息卡片代码

2025-07-08 0 333

功能特点:

  1. 响应式设计卡片自适应大小,在手机和电脑上都能良好显示

  2. 动态数据:使用PHP变量存储网站信息,方便修改

  3. 现代UI

    • 渐变背景与柔和阴影

    • 悬停动画效果

    • 优雅的卡片布局

  4. 交互元素

    • 可点击的网站链接

    • 访问按钮带悬停效果

  5. 自动版权年份:使用date('Y')自动显示当前年份

复制下方代码

<?php
// 网站信息卡片
$siteName = "精码云库";
$siteUrl = "https://www.jmkuc.com";
$description = "专注于编程资源与开发工具分享";
?>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $siteName; ?> - 信息卡片</title>
    <style>
        .info-card {
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
            width: 350px;
            border-radius: 12px;
            box-shadow: 0 8px 20px rgba(0,0,0,0.12);
            overflow: hidden;
            background: linear-gradient(135deg, #f5f7fa 0%, #e4edf9 100%);
            border: 1px solid #e1e8f0;
            margin: 20px auto;
            transition: transform 0.3s ease;
        }
        
        .info-card:hover {
            transform: translateY(-5px);
        }
        
        .card-header {
            background: linear-gradient(90deg, #4361ee 0%, #3a0ca3 100%);
            color: white;
            padding: 20px;
            text-align: center;
        }
        
        .card-body {
            padding: 25px;
            color: #333;
        }
        
        .site-name {
            font-size: 1.8rem;
            font-weight: 700;
            margin: 0 0 10px 0;
            letter-spacing: 1px;
        }
        
        .site-url {
            display: block;
            font-size: 1.1rem;
            color: #4cc9f0;
            margin: 15px 0;
            word-break: break-all;
            text-decoration: none;
            font-weight: 600;
        }
        
        .site-url:hover {
            text-decoration: underline;
            color: #4895ef;
        }
        
        .description {
            font-size: 1rem;
            line-height: 1.6;
            color: #4a5568;
            border-top: 1px dashed #cbd5e0;
            padding-top: 15px;
            margin-top: 15px;
        }
        
        .visit-btn {
            display: block;
            width: 100%;
            padding: 12px;
            background: linear-gradient(90deg, #4895ef 0%, #4361ee 100%);
            color: white;
            text-align: center;
            border-radius: 6px;
            font-weight: 600;
            text-decoration: none;
            margin-top: 20px;
            transition: all 0.3s ease;
        }
        
        .visit-btn:hover {
            background: linear-gradient(90deg, #4361ee 0%, #3f37c9 100%);
            box-shadow: 0 4px 12px rgba(67, 97, 238, 0.4);
        }
        
        .footer {
            text-align: center;
            padding: 15px;
            font-size: 0.8rem;
            color: #718096;
            background-color: #f8fafc;
            border-top: 1px solid #edf2f7;
        }
    </style>
</head>
<body>
    <div class="info-card">
        <div class="card-header">
            <h2>网站信息卡片</h2>
        </div>
        
        <div class="card-body">
            <div class="site-name"><?php echo $siteName; ?></div>
            
            <a href="<?php echo $siteUrl; ?>" rel="external nofollow"  rel="external nofollow"  class="site-url" target="_blank">
                <?php echo $siteUrl; ?>
            </a>
            
            <p class="description"><?php echo $description; ?></p>
            
            <a href="<?php echo $siteUrl; ?>" rel="external nofollow"  rel="external nofollow"  class="visit-btn" target="_blank">
                访问网站
            </a>
        </div>
        
        <div class="footer">
            精码云库 &copy; <?php echo date('Y'); ?> 版权所有
        </div>
    </div>
</body>
</html>

 

源码截图

PHP编写网站信息卡片代码

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

精码云库 免费源码 PHP编写网站信息卡片代码 https://www.jmkuc.com/1324.html

常见问题
  • 可能原因有:一是您的解压软件版本较低,不支持该压缩格式,建议更新解压软件至最新版;二是下载过程中文件损坏,您可尝试删除原文件,重新下载;若多次重新下载仍解压失败,可能是资源本身存在问题,请联系我们反馈,我们会尽快核实处理。
查看详情
  • 出现此情况,大概率是页面样式冲突所致。部分浏览器可能对某些 CSS 样式兼容性欠佳,当文章内复杂样式相互作用时,就可能导致布局异常。您可尝试刷新页面,若问题依旧,可切换到其他主流浏览器访问;或者检查您浏览器是否有安装可能干扰页面显示的插件,暂时禁用后再尝试浏览。
查看详情
  • 您可先在本站搜索栏输入相关关键词,筛选是否有对应源码的其他版本资源。若未找到,您可以通过 “问题反馈” 板块,向我们详细说明需求,包括文章名称、所需源码版本及用途等,我们会根据情况在后续资源整理中,优先为您补充相关版本资源。
查看详情
  • 可能是由于运行环境不匹配,如编程语言版本、依赖库缺失或版本不一致导致。您可先检查文章中是否有注明运行环境要求,按照要求配置;也可尝试在本站技术交流区搜索报错关键词,查看其他用户的解决方案;若仍无法解决,欢迎通过 “问题反馈” 提交报错信息和运行环境说明,我们将协助排查 。
查看详情

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务