dede两个网站共用一个数据库前端文章页面图片路径问题

有时候,我们会两个pc链接同一个数据库或者pc和手机站链接同一个数据库,所以但我们在一个站发布文章时,文章生成的缩略图会在该文章发布的网站文件夹  uploads ,另外一个网站文件夹 uploads 下是没有同步生成的;

如图:

 a.com站:

a.com站:

b.com站:

今天,我们设置一下,使前端页面同步显示a.com的缩略图,

 

(注:后台文章编辑框内的文章图片是没法显示的,但不会显示前端页面的显示)

下面代码主要在b.com下的文件添加修改

修改目录include下的文件extend.func.php,在最后面添加一个函数方法:

function replaceurl($newurl)
{
$newurl=str_replace('src="/uploads/allimg/','src="http://你的域名/uploads/allimg/',$newurl);
return $newurl;
}

另外调用文章正文内容的标签

{dede:field.body/}

需要改成

{dede:field.body function='replaceurl(@me)'/}

最后更新一下就可以看到效果了。    >_<

 

 

转载于:https://www.cnblogs.com/linyusong/p/6510581.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,可以给您提供一份基础的用户登录页面的代码,您可以自行根据实际需求进行调整和修改: ``` <!DOCTYPE html> <html> <head> <title>用户登录</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 引入jQuery库 --> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <style type="text/css"> body { font-family: Arial, sans-serif; background-color: #f2f2f2; } .container { width: 400px; margin: 0 auto; padding: 20px; background-color: #fff; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } h1 { text-align: center; margin-top: 0; } label { display: block; margin-bottom: 10px; font-weight: bold; } input[type="text"], input[type="password"] { display: block; width: 100%; padding: 5px; margin-bottom: 20px; border: none; border-radius: 5px; box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1); } input[type="submit"] { display: block; margin: 0 auto; padding: 10px 20px; background-color: #4CAF50; border: none; border-radius: 5px; color: #fff; cursor: pointer; transition: background-color 0.3s ease-in-out; } input[type="submit"]:hover { background-color: #3E8E41; } .error { padding: 10px; background-color: #f2dede; color: #a94442; border-radius: 5px; margin-bottom: 10px; } .success { padding: 10px; background-color: #dff0d8; color: #3c763d; border-radius: 5px; margin-bottom: 10px; } </style> </head> <body> <div class="container"> <h1>用户登录</h1> <form id="login-form" action="login.php" method="post"> <label for="username">用户名</label> <input type="text" id="username" name="username" required> <label for="password">密码</label> <input type="password" id="password" name="password" required> <input type="submit" value="登录"> </form> </div> <script type="text/javascript"> $(function(){ $('#login-form').submit(function(e){ e.preventDefault(); var username = $('#username').val(); var password = $('#password').val(); // TODO: 发送登录请求的代码 }); }); </script> </body> </html> ``` 这是一个简单的用户登录页面,包括用户名、密码两个输入框和一个登录按钮。在用户点击登录按钮时,会触发一个JavaScript函数,你可以在这个函数中编写发送登录请求的代码。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值