コード例 #1
0
ファイル: example-5-08.php プロジェクト: Higashi0809/php
}
// Acceptable ways to call this function:
//page_header5('66cc99','my wonderful page'); // uses default $header
//page_header5('66cc99','my wonderful page','This page is great!'); // no defaults
// Two optional arguments: must be last two arguments
function page_header6($color, $title = 'the page', $header = 'Welcome')
{
    print '<html><head><title>Welcome to ' . $title . '</title></head>';
    print '<body bgcolor="#' . $color . '">';
    print "<h1>{$header}</h1>";
}
// Acceptable ways to call this function:
//page_header6('66cc99'); // uses default $title and $header
//page_header6('66cc99','my wonderful page'); // uses default $header
//page_header6('66cc99','my wonderful page','This page is great!'); // no defaults
// All optional arguments
function page_header6($color = '336699', $title = 'the page', $header = 'Welcome')
{
    print '<html><head><title>Welcome to ' . $title . '</title></head>';
    print '<body bgcolor="#' . $color . '">';
    print "<h1>{$header}</h1>";
}
// Acceptable ways to call this function:
page_header7();
// uses all defaults
page_header7('66cc99');
// uses default $title and $header
page_header7('66cc99', 'my wonderful page');
// uses default $header
page_header7('66cc99', 'my wonderful page', 'This page is great!');
// no defaults
コード例 #2
0
ファイル: example-5-03.php プロジェクト: Higashi0809/php
<meta charset=UTF-8>

<?php 
require_once 'example-5-04.php';
require_once 'example-5-05.php';
require_once 'example-5-06.php';
function page_header()
{
    print '<html><head><title>Welcome to my site</title></head>';
    print '<body bgcolor="#ffffff">';
}
//page_header();
//page_header3('cc00cc');
//page_header4('66cc66','Kakazu\'s page');
//page_header6('66cc99','Kakazu\'s Page!!!')
page_header7();
// uses all defaults
//page_header7('66cc99'); // uses default $title and $header
//page_header7('66cc99','my wonderful page'); // uses default $header
//page_header7('66cc99','my wonderful page','This page is great!'); // no defaults
$user = '******';
print "Welcome, {$user}";
page_footer();
function page_footer()
{
    print '<hr>Thanks for visiting.';
    print '</body></html>';
}