我使用jQuery创建了一个小应用程序datepicker.我从json文件设置不可用的日期,如下所示:
{ "dates": ["2013-12-11", "2013-12-10", "2013-12-07", "2013-12-04"] }
Run Code Online (Sandbox Code Playgroud)
我想检查一下给定的日期是否已经在此列表中,如果是,则将其删除.我当前的代码如下所示:
if (isset($_GET['date'])) //the date given
{
if ($_GET['roomType'] == 2)
{
$myFile = "bookedDates2.json";
$date = $_GET['date'];
if (file_exists($myFile))
{
$arr = json_decode(file_get_contents($myFile), true);
if (!in_array($date, $arr['dates']))
{
$arr['dates'][] = $_GET['date']; //adds the date into the file if it is not there already
}
else
{
foreach ($arr['dates'] as $key => $value)
{
if (in_array($date, $arr['dates']))
{
unset($arr['dates'][$key]);
array_values($arr['dates']);
}
}
}
}
$arr = json_encode($arr);
file_put_contents($myFile, $arr);
} …Run Code Online (Sandbox Code Playgroud) 我正在努力在页面标题中添加一个图标。到目前为止,我已经尝试过像这样添加它:
<title>
<link rel="icon" href="{!! asset('images/gcm_ico.ico') !!}"/>@yield('page-title')
</title>
但它在所有浏览器中都已逸出,如下所示:
我也尝试打印链接
{{ "<link rel='icon' hrer='".asset("images/gcm_ico.ico")."' />" }}.
Run Code Online (Sandbox Code Playgroud)
有人成功做到了吗?提前致谢