我怎么这样做?我看了phpThumb.php并设置了以下内容,所以我不知道为什么我在我的演示页面上收到错误
ini_set('display_errors', 1);
error_reporting(E_ALL);
Run Code Online (Sandbox Code Playgroud) 我正在使用wordpress的高级自定义字段插件,这意味着我的一些页面中已经存在已停用的内容编辑器,因此我想在某些页面上禁用它们.我发现下面的一些网站的代码,但是这在后台创建了一个错误Undefined index: post,并Undefined index: post_ID
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
if( !isset( $post_id ) ) return;
// Get the name of the Page Template file.
$template_file = get_post_meta($post_id, '_wp_page_template', true);
if($template_file == 'contact.php'){ // edit the template name
remove_post_type_support('page', 'editor');
}
}
Run Code Online (Sandbox Code Playgroud) 我想修改搜索,所以如果说我有一个名为"作者"的分类,并在帖子中添加"Ian Rankin"一词,如果我搜索"Ian Rankin",我希望该帖子出现.我想目前它只搜索标题和内容. 我怎样才能使它成为搜索词呢?
我创建了一个帖子,然后它说我已经发布但是当我点击网址时,我找不到一个页面!
这是我的自定义帖子设置代码:
add_action('init', 'offered_register');
function offered_register() {
$labels = array(
'name' => _x('Offered items'),
'singular_name' => _x('Item'),
'add_new' => _x('Give an item away'),
'add_new_item' => __('Give a new item away'),
'edit_item' => __('Edit item'),
'new_item' => __('Give Item Away'),
'view_item' => __('View Item'),
'search_items' => __('Search Offered Items'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true, …Run Code Online (Sandbox Code Playgroud) 我需要在所有#tips li元素上删除所有类别的'no-right-marg'.然后我需要用一个被点击元素的ID隐藏所有这些元素.然后,我需要检查哪些元素仍在显示,并为每四个元素添加一个"no-right-marg"类.我的代码不起作用.请参阅我的jsfiddle http://jsfiddle.net/VCZc4/2/
jQuery('#selector li').click(function() {
colour = '.' + jQuery(this).attr('id');
jQuery('#tips ' + colour).toggle();
jQuery(this).toggleClass('inactive');
jQuery('#tips li').removeClass('no-right-marg');
jQuery('#tips li:visible').each(function(index){
if(index %4===0 ){// if divisible by 4
jQuery(this).addClass('.no-right-marg');
}
});
});?
Run Code Online (Sandbox Code Playgroud)
HTML
<ul id="selector">
<li id="brown">button 1</a>
<li id="green">button 2</a>
<li id="blue">button 3</a>
<li id="orange">button 4</a>
</ul>
<ul id="tips">
<li class="brown">text</li>
<li class="orange">text</li>
<li class="blue">text</li>
<li class="blue no-right-marg">text</li>
<li class="blue">text</li>
<li class="orange">text</li>
<li class="blue">text</li>
<li class="blue no-right-marg">text</li>
<li class="green">text</li>
</ul>
?
Run Code Online (Sandbox Code Playgroud) 我有一个要通过jQuery中的formatDate函数存储为时间戳的日期。然后,我将检索此值以创建一个ics文件,这是一个日历文件,它将事件时间和详细信息添加到用户日历中。但是,时间戳格式在ics文件中不起作用,未添加正确的日期,因此我需要将其转换为类似于的值20091109T101015Z。它是当前的时间戳格式,看起来像1344466800000这是来自此示例的,这是我创建ics文件所遵循的格式。
我到php文件的链接是http://域。com / icsCreator.php?startDate = 1344380400000&endDate = 1345503600000&event = Space%20Weather%20Workshop&location =伦敦
当前我的ics文件看起来像
<?php
$dtStart=$_GET['startDate'];
$dtEnd=$_GET['endDate'];
$eventName=$_GET['event'];
$location=$_GET['location'];
...
echo "CREATED:20091109T101015Z\n";
echo "DESCRIPTION:$eventName\n";
echo "DTEND:$dtEnd\n";
echo "DTSTART:".$dtStart."\n";
echo "LAST-MODIFIED:20091109T101015Z\n";
echo "LOCATION:$location\n";
...
?>
Run Code Online (Sandbox Code Playgroud) 我有以下结构,我想知道是否.curent-menu-item有一个类的孩子.sub-menu
<li class="curent-menu-item">
<a>text</a>
<ul class="sub-menu">
<li>item</li>
<li>item</li>
</ul>
</li>
<li>text</li>
Run Code Online (Sandbox Code Playgroud) 我正在整理我的代码,这对我删除Formhandler函数外部的登录函数很有意义。但是,当我在被调用函数中调用返回路由行时,它只是将该路由返回给父控制器,而父控制器则不执行任何操作。我希望在调用的函数中执行重定向。
public static function loginFormHandler(){
//some stuff is done
$this->doLogin();
}
public static function doLogin(){
if (\Auth::attempt($this->credentials, $this->remember)) {
return \Redirect::route("dashboard");
}
}
Run Code Online (Sandbox Code Playgroud)
它不是重定向,而是返回loginFormHandler,据我所知,因为它不会转到仪表板页面。
我有一个表'评论',调查有一个字段引用另一个表'sf_guard_user'.在我放的那一刻
<?php echo $investigationComment->getUserId() ?>
Run Code Online (Sandbox Code Playgroud)
我得到外表行的id值.我希望能够获得名称字段值.
在我的项目中的其他地方,我能够从getUserId()中省略id,然后put-> getName()并且它带给我那个字段值,但是为此它不会出于某种原因.如何获取外键行的名称值?
我有一个很长的列表,需要获得其中每个li的索引.这是我的HTML:
<ul id="myUl" class="playlist playlist-one cf">
<li id="test"><a href="#during-your-stay" class="playlist-link" >1. Privacy & Dignity for all</a>[00:34]</li>
<li><a href="#during-your-stay" class="playlist-link" >2. Medicines</a>[00:44]</li>
<li><a href="#during-your-stay" class="playlist-link" >3. Allergies</a>[00:25]</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我的jquery:
$(".playlist-link").click(function(){
var thisLi=$(this).parent();
var theUl= $(thisLi).parent();
var index =theUl.index(thisLi);
alert("ul id: " + theUl.attr('id') +"\n the li: " + thisLi.attr('id') +"\n index: "+index +"\n" )
});
Run Code Online (Sandbox Code Playgroud)
我的警报显示我的索引无效,因为它返回-1.但是我的语法正确(我认为)因为变量正在使用包含正确的元素.这是警报的输出:
ul id: myUl
the li: test
index: -1
Run Code Online (Sandbox Code Playgroud)
那么为什么它会返回-1 ???
我试图使用strpos查找字符串是否存在,然后使用substr_replace删除该字符串.我的代码如下:
$title=$item->get_title();
$stringToFind='Help needed identifying this person in ';
if(strpos($title,$stringToFind)){
$title=substr_replace($title,'',0,strlen($stringToFind));
}
Run Code Online (Sandbox Code Playgroud)
但是,当我对strpos进行回声时,它总是返回false,应该是真的.所以我想知道strpos是否不做空白或其他什么?在哪种情况下有人会推荐一些东西?