Dev
搜索

Dev

php include require区别
发表于2015-11-11|php
根据网上其他人的说法,而且没有什么区别 只有发生“错误”时, include只会提示一个警告,然后继续执行 require会抛出一个致命错误,程序停止
wp_verify_nonce
发表于2015-11-11|wordpress
<?php wp_verify_nonce( $nonce, $action ); ?> $nonce(string) (required) Nonce to verify.Default: None$action(string/int) (optional) Action name. Should give the context to what is taking place and be the same when the nonce was created.Default: -1 Return Values (boolean/integer) Boolean false if the nonce is invalid. Otherwise, returns an integer with the value of: 1 – if the nonce has been generated in the past 12 hours or less. 2 – if the nonce was generated between 12 and 24 hours ...
wordpress中有关即时验证的几个_nonce函数
发表于2015-11-11|wordpress
原文地址:http://www.utubon.com/post/877.html 在wordpress中,为了增加系统的验证安全性,内置了一些简单的验证,这些验证可以有效的防治注册、提交等操作,如果开发者在主题开发中,对数据库进行了操作,一定要使用到这些函数,本文就对这几个函数做一个详细的介绍。 一、wp_create_nonce wp_create_nonce的用法很简单,即一般用在链接中 它将有一个参数,这个参数相当于一个唯一标识ID,通过这个ID,你可以再后文的程序中进行检查。它的返回值即nonce,一个随机字符串。 wp_create_nonce(?$action?); 它的使用例如: <?php?$nonce=?wp_create_nonce??('my-nonce');??> <a?href='myplugin.php?_wpnonce=<?php?echo?$nonce??>'>?... <?php$nonce=$_REQUEST[‘_wpnonce’];if?(!?wp_verify_nonce($nonce,...
解决wordpress函数send_to_editor修改后影响原来自带“添加媒体”功能的问题
发表于2015-11-11|wordpress
要做一个简单的功能,如下图所示,点击上传图片弹出wp的媒体中心 上传图片,结束之后,点击“插入到文章”,这是文本框获取到图片的url, 方法是改写了window.send_to_editor函数,结果发生了冲突,点击自带编辑器的“添加媒体”也还是把图片的url插入到这里 解决方法很简单,就是先记录下原来的函数,当操作完成后再把这个函数还原。 可以不影响自带功能的js代码: jQuery(document).ready(function() {jQuery(‘#uploadBtn’).click(function(){targetfield = jQuery(this).prev(‘#uploadImg’);tb_show(‘’, ‘media-upload.php?type=image&amp;TB_iframe=true’);//打开上传窗口return false;});var original_send_to_editor = window.send_to_editor;window.send_to_ed...
add meta box(添加Meta模块)
发表于2015-11-09|wordpress
<?php add_meta_box( $id, $title, $callback, $post_type, $context,$priority, $callback_args ); ?> $id (字符串)(必需)Meta模块的 HTML“ID”属性 $title (字符串)(必需)Meta模块的标题,对用户可见 $callback (回调)(必需)为Meta模块输出 HTML代码的函数 $post_type (字符串)(必需)显示Meta模块的文章类型,可以是文章(post)、页面(page)、链接(link)、附件(attachment) 或 自定义文章类型(自定义文章类型的别名) $context (字符串)(可选)Meta模块的显示位置(’normal’,’advanced’, 或 ‘side’) 默认值:’advanced’ $priority (字符串)(可选)Meta模块显示的优先级别(’high’, ‘core’, ‘default’or ‘low’) 默认值: ‘default’ $callback_args (数...
wp_editor 函数
发表于2015-11-09|wordpress
<?php wp_editor( $content, $editor_id, $settings = array() ); ?> $content – textarea中的内容 $editor_id – 编辑器的HTML ID,只能包含小写字母 $settings – 设置选项,是一个数组,可以设置的参数包括: wpautop – 是否开启wpautop,默认为true media_buttons – 是否显示上传多媒体的按钮,默认true textarea_name – textarea的name属性,默认与$editor_id相同 textarea_rows – textarea的rows属性,默认是get_option('default_post_edit_rows', 10),这一项在后台设置 tabindex – tabindex数值,tabindex规定用户用键盘的tab键切换表单元素时的顺序。 editor_css – 给编辑器添加css样式,适用于visual和html模式,必须包含<style>标签 teeny –...
wordpress显示上传图片的媒体中心
发表于2015-11-09|wordpress
jQuery(document).ready(function() {tb_show(‘’, ‘media-upload.php?type=image&amp;TB_iframe=true’);})
wordpress文本编辑器js函数window.send_to_editor
发表于2015-11-09|wordpress
在wordpress的javascript库中有一个函数用来实现向wp_editor(php)函数(用来打印文本编辑器)中插入内容的函数,即window.send_to_editor,网上关于它的讨论特别多。我们这里只是简单的使用它,不去探讨它的原理。 上文我们提到,我们希望通过在媒体编辑器中添加一段代码(如php),点击插入之后把这段代码插入到当前编辑的光标处。但我们不能直接使用window.send_to_editor,因为上面提到,我们自己创建的管理面板内容是被放在iframe中,因此,我们必须使用window.parent,代码如下: $('#btn').click(function(){ window.parent.send_to_editor($html); window.parent.tb_remove(); }); 其中,$html可以是任意的html代码,它将被插入到当前的光标处。而第二句window.parent.tb_remove();则是插入之后要把媒体管理面板关闭。
wordpress自定义字段
发表于2015-11-09|wordpress
对自定义字段的主要操作有四种:添加、更新(修改)、删除、获取(值)。 1、首先自定义字段的添加函数,改函数可以为文章往数据库中添加一个字段: <?php add_post_meta($post_id, $meta_key, $meta_value, $unique); //$post_id--文章id //$meta_key--字段名称 //$meta_value--值 //$unique--(布尔值、可选)字段是否唯一,如果设置为true,那么添加字段的时候如果这个字段已经存在了,就不会再添加 ?> 2、自定义字段的更新函数,该函数可以更新一个已经存在的字段: <?php update_post_meta($post_id, $meta_key, $meta_value, $prev_value); //$post_id--文章id //$meta_key--字段名称 //$meta_value--新的值 //$prev_value--(可选)以前的值,如果这个字段有几个,那么只会更新匹配的这个值 ?&g...
wp_enqueue_script
发表于2015-11-09|wordpress
WordPress 本身以及主题和插件通常需要加载一些 JavaScript 来实现某些特殊功能。为了最大限度地保证兼容性,不至于出现 JavaScript 失效的情况,所以一般在页头加载 JavaScript 文件。 但是我们一般不建议直接去修改主题的 header.php,或者添加代码到 wp_head() 或 wp_footer() 钩子上,而是要使用 WordPress 官方文档建议使用的 WP 内建的wp_enqueue_script() 和 wp_enqueue_style() 等函数进行操作。 函数:wp_enqueue_script() 函数用法: <?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?> 参数解释: $handle:用于区别 JS 名称,即标识字串 (string); $src:JS 的文件 URL (string); $deps:加载的 JS 所依存的其他 JS 标识字串数组 (array:string, 非必需); $ver:JS 的...
1…929394…102
avatar
developer
AI相伴的开发者博客
文章
1018
标签
718
分类
34
Follow Me
公告
This is my Blog
最新文章
cmder使用记录2026-03-08
flutter getx使用记录2026-03-01
统计代码行数2026-02-27
php easywechat 6.x 微信支付 手动解密2026-02-25
php 反引号 执行shell脚本2026-02-25
分类
  • apicloud3
  • bootstrap8
  • cmder1
  • cocos2d-js5
  • createjs17
  • day45
  • docker16
  • egret14
标签
公众号 格式化 权限 mysql_fetch_object thinkphp face++ mysql_fetch_row 云服务器 微信支付 is_singular td 转换 获取真实 Function [object Object] 去掉小程序边框线 date 备忘录 开放平台 Post Formats 队列 外泄的 soffice PHP unable current 豆腐 继续滑动一会 tp 备份 zip命令 dl animate动画 redis 文本搜索 算法 和 查看 parse_str 对象存储
归档
  • 三月 2026 2
  • 二月 2026 5
  • 一月 2026 3
  • 十二月 2025 5
  • 十一月 2025 2
  • 十月 2025 5
  • 九月 2025 5
  • 八月 2025 2
网站信息
文章数目 :
1018
最后更新时间 :
© 2025 - 2026 By developer框架 Hexo 8.1.1|主题 Butterfly 5.5.4
搜索
数据加载中