Maison développement back-end tutoriel php thinkphp批改及编写标签库,编辑器的使用

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

Jun 13, 2016 pm 12:22 PM
gt lt php

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="php"><span class="dec"><!DOCTYPE html></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="php"><span class="tag"><html></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="php"><span class="tag"><head></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="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="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="php"><span class="tag"></head></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L6"><code class="php"><span class="tag"><body></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L7"><code class="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="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="php"></code></li><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="php"><span class="tag"></body></span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="php"><span class="tag"></html></span></code></li></ol>
Copier après la connexion

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

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="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="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="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="php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Copier après la connexion


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


把输出的几项全部改为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="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="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="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="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="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="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="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="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="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="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="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="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="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="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="php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Copier après la connexion

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

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="php"><span class="pln">    </span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L1"><code class="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="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="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="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="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="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="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="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="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="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="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="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="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="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="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="php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Copier après la connexion

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="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="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="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="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="php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Copier après la connexion

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="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="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>
Copier après la connexion

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


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

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="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="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="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="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="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="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="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="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="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="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="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="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="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="php"></code></li><li style="list-style-type: none; padding-left: 0px;" class="L4"><code class="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="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="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="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="php"><span class="pln">        </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L9"><code class="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="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="php"><span class="pln">        </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="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="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="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="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="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="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="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="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="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="php"><span class="pln">            </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L2"><code class="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="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="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="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="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="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="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="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="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="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="php"><span class="pln">            </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L3"><code class="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="php"><span class="pln">        </span><span class="pun">}</span></code></li><li style="list-style-type: none; padding-left: 0px;" class="L5"><code class="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="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="php"><span class="pln">    </span><span class="pun">}</span></code></li></ol>
Copier après la connexion

引入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="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>
Copier après la connexion



thinkphp里面放百度编辑器

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="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="php"><span class="pln">            </span></code></li></ol>
Copier après la connexion

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

<ol class="linenums" style="padding-left: 0px;"><li style="list-style-type: none; padding-left: 0px;" class="L0"><code class="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="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>
Copier après la connexion







来自为知笔记(Wiz)



Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn

Outils d'IA chauds

Undresser.AI Undress

Undresser.AI Undress

Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover

AI Clothes Remover

Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool

Undress AI Tool

Images de déshabillage gratuites

Clothoff.io

Clothoff.io

Dissolvant de vêtements AI

AI Hentai Generator

AI Hentai Generator

Générez AI Hentai gratuitement.

Article chaud

R.E.P.O. Crystals d'énergie expliqués et ce qu'ils font (cristal jaune)
1 Il y a quelques mois By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Meilleurs paramètres graphiques
1 Il y a quelques mois By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Vous avez un jeu croisé?
1 Il y a quelques mois By 尊渡假赌尊渡假赌尊渡假赌

Outils chauds

Bloc-notes++7.3.1

Bloc-notes++7.3.1

Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise

SublimeText3 version chinoise

Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1

Envoyer Studio 13.0.1

Puissant environnement de développement intégré PHP

Dreamweaver CS6

Dreamweaver CS6

Outils de développement Web visuel

SublimeText3 version Mac

SublimeText3 version Mac

Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Guide d'installation et de mise à niveau de PHP 8.4 pour Ubuntu et Debian Guide d'installation et de mise à niveau de PHP 8.4 pour Ubuntu et Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 apporte plusieurs nouvelles fonctionnalités, améliorations de sécurité et de performances avec une bonne quantité de dépréciations et de suppressions de fonctionnalités. Ce guide explique comment installer PHP 8.4 ou mettre à niveau vers PHP 8.4 sur Ubuntu, Debian ou leurs dérivés. Bien qu'il soit possible de compiler PHP à partir des sources, son installation à partir d'un référentiel APT comme expliqué ci-dessous est souvent plus rapide et plus sécurisée car ces référentiels fourniront les dernières corrections de bogues et mises à jour de sécurité à l'avenir.

Comment configurer Visual Studio Code (VS Code) pour le développement PHP Comment configurer Visual Studio Code (VS Code) pour le développement PHP Dec 20, 2024 am 11:31 AM

Visual Studio Code, également connu sous le nom de VS Code, est un éditeur de code source gratuit – ou environnement de développement intégré (IDE) – disponible pour tous les principaux systèmes d'exploitation. Avec une large collection d'extensions pour de nombreux langages de programmation, VS Code peut être c

7 fonctions PHP que je regrette de ne pas connaître auparavant 7 fonctions PHP que je regrette de ne pas connaître auparavant Nov 13, 2024 am 09:42 AM

Si vous êtes un développeur PHP expérimenté, vous aurez peut-être le sentiment d'y être déjà allé et de l'avoir déjà fait. Vous avez développé un nombre important d'applications, débogué des millions de lignes de code et peaufiné de nombreux scripts pour réaliser des opérations.

Comment analysez-vous et traitez-vous HTML / XML dans PHP? Comment analysez-vous et traitez-vous HTML / XML dans PHP? Feb 07, 2025 am 11:57 AM

Ce tutoriel montre comment traiter efficacement les documents XML à l'aide de PHP. XML (Language de balisage extensible) est un langage de balisage basé sur le texte polyvalent conçu à la fois pour la lisibilité humaine et l'analyse de la machine. Il est couramment utilisé pour le stockage de données et

Expliquez les jetons Web JSON (JWT) et leur cas d'utilisation dans les API PHP. Expliquez les jetons Web JSON (JWT) et leur cas d'utilisation dans les API PHP. Apr 05, 2025 am 12:04 AM

JWT est une norme ouverte basée sur JSON, utilisée pour transmettre en toute sécurité des informations entre les parties, principalement pour l'authentification de l'identité et l'échange d'informations. 1. JWT se compose de trois parties: en-tête, charge utile et signature. 2. Le principe de travail de JWT comprend trois étapes: la génération de JWT, la vérification de la charge utile JWT et l'analyse. 3. Lorsque vous utilisez JWT pour l'authentification en PHP, JWT peut être généré et vérifié, et les informations sur le rôle et l'autorisation des utilisateurs peuvent être incluses dans l'utilisation avancée. 4. Les erreurs courantes incluent une défaillance de vérification de signature, l'expiration des jetons et la charge utile surdimensionnée. Les compétences de débogage incluent l'utilisation des outils de débogage et de l'exploitation forestière. 5. L'optimisation des performances et les meilleures pratiques incluent l'utilisation des algorithmes de signature appropriés, la définition des périodes de validité raisonnablement,

Programme PHP pour compter les voyelles dans une chaîne Programme PHP pour compter les voyelles dans une chaîne Feb 07, 2025 pm 12:12 PM

Une chaîne est une séquence de caractères, y compris des lettres, des nombres et des symboles. Ce tutoriel apprendra à calculer le nombre de voyelles dans une chaîne donnée en PHP en utilisant différentes méthodes. Les voyelles en anglais sont a, e, i, o, u, et elles peuvent être en majuscules ou en minuscules. Qu'est-ce qu'une voyelle? Les voyelles sont des caractères alphabétiques qui représentent une prononciation spécifique. Il y a cinq voyelles en anglais, y compris les majuscules et les minuscules: a, e, i, o, u Exemple 1 Entrée: String = "TutorialSpoint" Sortie: 6 expliquer Les voyelles dans la chaîne "TutorialSpoint" sont u, o, i, a, o, i. Il y a 6 yuans au total

Expliquez la liaison statique tardive en PHP (statique: :). Expliquez la liaison statique tardive en PHP (statique: :). Apr 03, 2025 am 12:04 AM

Liaison statique (statique: :) ​​implémente la liaison statique tardive (LSB) dans PHP, permettant à des classes d'appel d'être référencées dans des contextes statiques plutôt que de définir des classes. 1) Le processus d'analyse est effectué au moment de l'exécution, 2) Recherchez la classe d'appel dans la relation de succession, 3) il peut apporter des frais généraux de performance.

Quelles sont les méthodes PHP Magic (__construct, __ destruct, __ call, __get, __set, etc.) et fournir des cas d'utilisation? Quelles sont les méthodes PHP Magic (__construct, __ destruct, __ call, __get, __set, etc.) et fournir des cas d'utilisation? Apr 03, 2025 am 12:03 AM

Quelles sont les méthodes magiques de PHP? Les méthodes magiques de PHP incluent: 1. \ _ \ _ Construct, utilisé pour initialiser les objets; 2. \ _ \ _ Destruct, utilisé pour nettoyer les ressources; 3. \ _ \ _ Appel, gérer les appels de méthode inexistants; 4. \ _ \ _ GET, Implémentez l'accès à l'attribut dynamique; 5. \ _ \ _ SET, Implémentez les paramètres d'attribut dynamique. Ces méthodes sont automatiquement appelées dans certaines situations, améliorant la flexibilité et l'efficacité du code.

See all articles