Heim > Backend-Entwicklung > PHP-Tutorial > thinkphp批改及编写标签库,编辑器的使用

thinkphp批改及编写标签库,编辑器的使用

WBOY
Freigeben: 2016-06-13 12:22:39
Original
984 Leute haben es durchsucht

thinkphp修改及编写标签库,编辑器的使用
在view目录下创建Index_aaa.html

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="dec"><!DOCTYPE html></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="tag"><html></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="tag"><head></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="tag"><meta</span><span class="pln"> </span><span class="atn">charset</span><span class="pun">=</span><span class="atv">"UTF-8"</span><span class="tag">></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="tag"><title></span><span class="pln">select</span><span class="tag"></title></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="tag"></head></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="tag"><body></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="tag"><tagLib</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"html"</span><span class="tag">/></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L8"><code class="language-php"><span class="tag"><html:select</span><span class="pln"> </span><span class="atn">options</span><span class="pun">=</span><span class="atv">"address"</span><span class="pln"> </span><span class="atn">selected</span><span class="pun">=</span><span class="atv">"sh"</span><span class="pln">  </span><span class="atn">values</span><span class="pun">=</span><span class="atv">"address"</span><span class="tag">/></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="language-php"></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="tag"></body></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="tag"></html></span></code></li></ol>
Nach dem Login kopieren

在IndexController.class.php里面编写函数

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> aaa</span><span class="pun">(){</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">        $this</span><span class="pun">-></span><span class="pln">assign</span><span class="pun">(</span><span class="str">"address"</span><span class="pun">,[</span><span class="str">"sh"</span><span class="pun">=></span><span class="pln"> </span><span class="str">"上海"</span><span class="pun">,</span><span class="str">"天津"</span><span class="pun">,</span><span class="str">"北京"</span><span class="pun">,</span><span class="str">"郑州"</span><span class="pun">]);</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">        $this</span><span class="pun">-></span><span class="pln">display</span><span class="pun">();</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Nach dem Login kopieren


修改此文件可以编写标签库


把输出的几项全部改为val即可解决values='0'

的问题,让values的值等于option的值


编写新的标签

'ms'=>array('attr'=>'id,name,options,selected','close'=>0)

<html:ms id="aa" name="uu" options="address" selected="北京"/><br>

修改后的代码selected的值可以随便写即可


<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">  </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> _ms</span><span class="pun">(</span><span class="pln">$tag</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">        $name       </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'name'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">        $options    </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'options'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">        $id         </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'id'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">        $selected   </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'selected'</span><span class="pun">];</span><span class="pln">      </span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">=</span><span class="pln"> </span><span class="str">'<select id="'</span><span class="pun">.</span><span class="pln">$id</span><span class="pun">.</span><span class="str">'" name="'</span><span class="pun">.</span><span class="pln">$name</span><span class="pun">.</span><span class="str">'" >'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">.=</span><span class="str">'<?php foreach($'</span><span class="pun">.</span><span class="pln">$options</span><span class="pun">.</span><span class="str">' as $val) { ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">.=</span><span class="str">'<?php if("'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">'"==$val) { ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L8"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<option selected="selected" value="<?php echo $val ?>"><?php echo $val ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } else { ?><option value="<?php echo $val ?>"><?php echo $val ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">             $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">             $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">             $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'</select>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">        </span><span class="kwd">return</span><span class="pln"> $parseStr</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Nach dem Login kopieren

可以根据分配的值来确定selected

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">    </span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> _ms</span><span class="pun">(</span><span class="pln">$tag</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">        $name       </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'name'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">        $options    </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'options'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">        $id         </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'id'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">        $selected   </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'selected'</span><span class="pun">];</span><span class="pln">      </span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">=</span><span class="pln"> </span><span class="str">'<select id="'</span><span class="pun">.</span><span class="pln">$id</span><span class="pun">.</span><span class="str">'" name="'</span><span class="pun">.</span><span class="pln">$name</span><span class="pun">.</span><span class="str">'" >'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">.=</span><span class="str">'<?php foreach($'</span><span class="pun">.</span><span class="pln">$options</span><span class="pun">.</span><span class="str">' as $val) { ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L8"><code class="language-php"><span class="pln">          </span><span class="com">/*  $parseStr .='<?php if("'.$selected.'"==$val) { ?>';*///selected的值可以随便写</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">.=</span><span class="str">'<?php if($'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">'==$val) { ?>'</span><span class="pun">;</span><span class="com">//值可以先分配再写</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<option selected="selected" value="<?php echo $val ?>"><?php echo $val ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } else { ?><option value="<?php echo $val ?>"><?php echo $val ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">             $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">             $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">             $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'</select>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">        </span><span class="kwd">return</span><span class="pln"> $parseStr</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Nach dem Login kopieren

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">    </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> aaa</span><span class="pun">(){</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">        $this</span><span class="pun">-></span><span class="pln">assign</span><span class="pun">(</span><span class="str">"address"</span><span class="pun">,[</span><span class="str">"上海"</span><span class="pun">,</span><span class="str">"天津"</span><span class="pun">,</span><span class="str">"北京"</span><span class="pun">,</span><span class="str">"郑州"</span><span class="pun">]);</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">        $this</span><span class="pun">-></span><span class="pln">assign</span><span class="pun">(</span><span class="str">"sh"</span><span class="pun">,</span><span class="str">"天津"</span><span class="pun">);</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">        $this</span><span class="pun">-></span><span class="pln">display</span><span class="pun">();</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Nach dem Login kopieren

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="tag"><tagLib</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"html"</span><span class="tag">/></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="tag"><html:ms</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"aa"</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"uu"</span><span class="pln"> </span><span class="atn">options</span><span class="pun">=</span><span class="atv">"address"</span><span class="pln"> </span><span class="atn">selected</span><span class="pun">=</span><span class="atv">"sh"</span><span class="tag">/><br></span></code></li></ol>
Nach dem Login kopieren

用框架本身带的也可以实现


把红线处的$key修改为$val用分配变量的方式也可以实现selected,系统自带的稍加修改,但是值不可以随便写在selected后

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln"> </span><span class="kwd">public</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> _select</span><span class="pun">(</span><span class="pln">$tag</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">        $name       </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'name'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">        $options    </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'options'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">        $values     </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'values'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">        $output     </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'output'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">        $multiple   </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'multiple'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">        $id         </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'id'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="pln">        $size       </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'size'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L8"><code class="language-php"><span class="pln">        $first      </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'first'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="language-php"><span class="pln">        $selected   </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'selected'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">        $style      </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'style'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">        $ondblclick </span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'dblclick'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">		$onchange	</span><span class="pun">=</span><span class="pln"> $tag</span><span class="pun">[</span><span class="str">'change'</span><span class="pun">];</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">        </span><span class="kwd">if</span><span class="pun">(!</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$multiple</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">=</span><span class="pln"> </span><span class="str">'<select id="'</span><span class="pun">.</span><span class="pln">$id</span><span class="pun">.</span><span class="str">'" name="'</span><span class="pun">.</span><span class="pln">$name</span><span class="pun">.</span><span class="str">'" ondblclick="'</span><span class="pun">.</span><span class="pln">$ondblclick</span><span class="pun">.</span><span class="str">'" onchange="'</span><span class="pun">.</span><span class="pln">$onchange</span><span class="pun">.</span><span class="str">'" multiple="multiple" class="'</span><span class="pun">.</span><span class="pln">$style</span><span class="pun">.</span><span class="str">'" size="'</span><span class="pun">.</span><span class="pln">$size</span><span class="pun">.</span><span class="str">'" >'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">        </span><span class="pun">}</span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="pln">        	$parseStr </span><span class="pun">=</span><span class="pln"> </span><span class="str">'<select id="'</span><span class="pun">.</span><span class="pln">$id</span><span class="pun">.</span><span class="str">'" name="'</span><span class="pun">.</span><span class="pln">$name</span><span class="pun">.</span><span class="str">'" onchange="'</span><span class="pun">.</span><span class="pln">$onchange</span><span class="pun">.</span><span class="str">'" ondblclick="'</span><span class="pun">.</span><span class="pln">$ondblclick</span><span class="pun">.</span><span class="str">'" class="'</span><span class="pun">.</span><span class="pln">$style</span><span class="pun">.</span><span class="str">'" >'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L8"><code class="language-php"><span class="pln">        </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="language-php"><span class="pln">        </span><span class="kwd">if</span><span class="pun">(!</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$first</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">            $parseStr </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<option value="" >'</span><span class="pun">.</span><span class="pln">$first</span><span class="pun">.</span><span class="str">'</option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">        </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">        </span><span class="kwd">if</span><span class="pun">(!</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$options</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php  foreach($'</span><span class="pun">.</span><span class="pln">$options</span><span class="pun">.</span><span class="str">' as $key=>$val) { ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">            </span><span class="kwd">if</span><span class="pun">(!</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$selected</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php if(!empty($'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">') && ($'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">' == $val || in_array($key,$'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">'))) { ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<option selected="selected" value="<?php echo $val ?>"><?php echo $val ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php }else { ?><option value="<?php echo $val ?>"><?php echo $val ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L8"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="language-php"><span class="pln">            </span><span class="pun">}</span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<option value="<?php echo $val ?>"><?php echo $val ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">            </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">        </span><span class="pun">}</span><span class="kwd">else</span><span class="pln"> </span><span class="kwd">if</span><span class="pun">(!</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$values</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php  for($i=0;$i<count($'</span><span class="pun">.</span><span class="pln">$values</span><span class="pun">.</span><span class="str">');$i++) { ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">            </span><span class="kwd">if</span><span class="pun">(!</span><span class="pln">empty</span><span class="pun">(</span><span class="pln">$selected</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php if(isset($'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">') && ((is_string($'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">') && $'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">' == $'</span><span class="pun">.</span><span class="pln">$values</span><span class="pun">.</span><span class="str">'[$i]) || (is_array($'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">') && in_array($'</span><span class="pun">.</span><span class="pln">$values</span><span class="pun">.</span><span class="str">'[$i],$'</span><span class="pun">.</span><span class="pln">$selected</span><span class="pun">.</span><span class="str">')))) { ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<option selected="selected" value="<?php echo $'</span><span class="pun">.</span><span class="pln">$values</span><span class="pun">.</span><span class="str">'[$i] ?>"><?php echo $'</span><span class="pun">.</span><span class="pln">$output</span><span class="pun">.</span><span class="str">'[$i] ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L8"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php }else { ?><option value="<?php echo $'</span><span class="pun">.</span><span class="pln">$values</span><span class="pun">.</span><span class="str">'[$i] ?>"><?php echo $'</span><span class="pun">.</span><span class="pln">$output</span><span class="pun">.</span><span class="str">'[$i] ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">            </span><span class="pun">}</span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">                $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<option value="<?php echo $'</span><span class="pun">.</span><span class="pln">$values</span><span class="pun">.</span><span class="str">'[$i] ?>"><?php echo $'</span><span class="pun">.</span><span class="pln">$output</span><span class="pun">.</span><span class="str">'[$i] ?></option>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="language-php"><span class="pln">            </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="language-php"><span class="pln">            $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'<?php } ?>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="language-php"><span class="pln">        </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="language-php"><span class="pln">        $parseStr   </span><span class="pun">.=</span><span class="pln"> </span><span class="str">'</select>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="language-php"><span class="pln">        </span><span class="kwd">return</span><span class="pln"> $parseStr</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="language-php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Nach dem Login kopieren

引入ueditor放在js里面修改ueditor.config.js为如下的代码

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">    window</span><span class="pun">.</span><span class="pln">UEDITOR_HOME_URL </span><span class="pun">=</span><span class="pln"> </span><span class="str">"/Public/js/ueditor/"</span><span class="pun">;</span><span class="pln">  </span></code></li></ol>
Nach dem Login kopieren



thinkphp里面放百度编辑器

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="pln">    $parseStr   </span><span class="pun">=</span><span class="pln"> </span><span class="str">'<script id="container" name="content" type="text/plain">这里写你的初始化内容</script><script type="text/javascript" src="__ROOT__/Public/js/ueditor/ueditor.config.js"></script><script type="text/javascript" src="__ROOT__/Public/js/ueditor/ueditor.all.js"></script><script type="text/javascript">        var ue = UE.getEditor("container",{emotionLocalization:true,lang:"zh-cn",initialFrameWidth:"80%",initialFrameHeight:320,textarea:"content",initialContent:"欢迎留言!",    autoClearinitialContent:true}); </script>'</span><span class="pun">;</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="pln">            </span></code></li></ol>
Nach dem Login kopieren

然后在Index_aaa.html 里面编写要显示的代码

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="language-php"><span class="tag"><tagLib</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"html"</span><span class="tag">/></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="language-php"><span class="tag"><html:editor</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"UEDITOR"</span><span class="tag">></html:editor></span></code></li></ol>
Nach dem Login kopieren







来自为知笔记(Wiz)



Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage