Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
1
10php
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yu Kimiduka
10php
Commits
b38a3662
Commit
b38a3662
authored
Jul 07, 2016
by
君塚 悠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
プログラム作成(calendar.php:カレンダー生成)
parent
ee0566dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
calendar.php
php/php10/day03-3/calendar.php
+39
-0
No files found.
php/php10/day03-3/calendar.php
0 → 100644
View file @
b38a3662
<?php
if
(
$_GET
[
'num'
]
==
''
)
{
$today_year
=
date
(
"Y"
);
$today_month
=
date
(
"n"
);
}
else
{
$timestamp
=
mktime
(
0
,
0
,
0
,
date
(
"n"
)
+
$_GET
[
'num'
],
date
(
"d"
),
date
(
"Y"
));
$today_year
=
date
(
"Y"
,
$timestamp
);
$today_month
=
date
(
"n"
,
$timestamp
);
}
$current
=
mktime
(
0
,
0
,
0
,
$today_month
,
1
,
$today_year
);
$first_day
=
date
(
"w"
,
$current
);
$last_day
=
date
(
"t"
,
$current
);
?>
<html>
<body>
<h1
style =
"background:#cccccc"
>
<?php
print
(
date
(
"Y年m月"
,
$current
));
?>
のカレンダ
</h1>
<table
border=
"1"
width=
"300"
>
<tr>
<th>
日
</th><th>
月
</th><th>
火
</th><th>
水
</th>
<th>
木
</th><th>
金
</th><th>
土
</th>
</tr>
<?php
for
(
$i
=
1
;
$i
<=
first_day
+
$last_day
;
$i
++
)
{
if
(
$i
%
7
==
1
)
{
print
(
"<tr>"
);}
if
(
$i
>
$first_day
)
{
print
(
"<td>"
.
(
$i
-
first
)
.
"</td>"
);
}
else
{
print
(
"<td> & nbsp;</td>"
);
}
if
(
$i
%
7
==
0
)
{
print
(
"</tr>"
);
}
}
?>
</table>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment