我有这个代码
<?php
setcookie('page', 'settings', time(),'/');
header('Location: settings.php');
?>
Run Code Online (Sandbox Code Playgroud)
但每次我用$ _COOKIE ['page']检查cookie都是空的?
我有个问题,
$fridays = array();
$fridays[0] = date('Y-m-d', strtotime('first friday of this month'));
$fridays[1] = date('Y-m-d', strtotime('second friday of this month'));
$fridays[2] = date('Y-m-d', strtotime('third friday of this month'));
$fridays[3] = date('Y-m-d', strtotime('fourth friday of this month'));
$fridays[4] = date('Y-m-d', strtotime('fifth friday of this month'));
Run Code Online (Sandbox Code Playgroud)
但周五没有第五个星期五.几个月有五个星期五.如何检查并不设置最后一项数组?
我开始为我的小型房地产业务创建一个网站.我玩了一些函数http://www.php.net mysql,我设法通过AJAX访问页面并返回搜索引擎的html内容.
我有一个已经填充了公寓和房屋的数据库
问题是如果公寓名称是"公寓"我返回html内容,如果"公寓有3个房间"它不再写任何东西.
我不明白我错在哪里:
<?php
$search = $_GET['selected'];
$link = mysql_connect('localhost', 'root', '');
mysql_select_db('houses', $link);
function searchHouse($search, $link){
$query = "select * from houses where name=$search limit 1";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$query2 = "select * from houses_info where house_id=$row[id]";
$result2 = mysql_query($query2);
$row = mysql_fetch_assoc($result2);
return $row;
}
$result = searchHouse($search, $link);
echo $result['house_sq'];
echo "<br>";
echo $result['house_rooms'];
echo "<br>";
echo $result['house_bathrooms'];
echo "<br>";
echo $result['house_address'];
?>
Run Code Online (Sandbox Code Playgroud) 我正在尝试格式化日期,但它不起作用?
$date = new DateTime('23/09/2012 08:12:14 AM');
echo $date->format('l, dS F Y, H:i:s A');
Run Code Online (Sandbox Code Playgroud)
任何提示?