---
title: "织梦 文章替换关键词"
author: "onestopweb"
date: "2017-03-13T10:26:34Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2017-03-13T10:26:34Z"
id: 2361736
url: "https://onestopweb.iteye.com/blog/2361736"
---

织梦直接输出文章的内容

```
{dede:field name='body'/}
```

 

织梦替换一个关键词后输出文章的内容

```
{dede:field.body function="str_replace('/uploads/allimg/','http://www.onestopweb.cn/uploads/allimg/',@me)" /}
```

 

织梦替换多个关键词后输出文章的内容

```
{dede:field.body runphp="yes"}
    $str=@me;
    $str1=array("AAA","BBB","/uploads/allimg/");
    $str2=array("aaa","bbb","http://www.onestopweb.cn/uploads/allimg/");
    $str3=str_replace($str1,$str2,$str);
    @me=$str3;
{/dede:field.body}
```