.


:




:

































 

 

 

 


.

.

. , .

\r ;

\n .

 

, php html.

, HTML .

 

, .

, , , .

 

, .

 

Integer

Double

String -

Bool - , true false

Array - .

 

$. .

.. . :

Gettype (<>) ;

Isset (<>) - true, .

 

.

 

. () , .. .

 

$z= String1.String2; // z Strng1String2

 

, .

, HTML

 

Lt;?php

$x=1;

echo " =$x <br>";

echo ' =$x ';

?>

 

:

 

=1

=$x

 

.

 

Echo x=.$x;

 

.. . , .

 

<?php

$var=" ";

echo "var= $var =". gettype($var)." <br> \r\n";

$var = 15;

echo ' var='.$var.' = '.gettype($var);

?>

 

Var= = string

var=15 = integer

 

.

 

array.

 

$myArray = array(one, 2, 3);

 

.

 

Echo array[0]; // one.

print_r()

Print_r($myArray)

Array([0]=>one [1]=>2 [2]=>3)

.

 

$myArray[ ]= ;

 

. . , () , .

 

$birthdays[Ivanov] = 1978-04-11;

$birthday[Petrov] = 1978-05-12;

 

array. .

 

$birthdays = array(Ivanov => 1978-04-11, Petrov => 1978-05-12);

 

, .

 

Echo . $birthdays[Ivanov];

 

 

.

 

$_GET $_REQUEST.

, name=Ivanov age=22, ..

 

<a href=Privet.php?name=Ivanov&age=22>

 

$_GET = array(name =>Ivanov, age=>22);

 

.

 

<?php

$name = $_GET['name'];

$age=$_GET[age];

echo ' , '. $name. '!';

echo <br> , $age ;

?>

.

IF

<?php

$name = $_REQUEST['firstname'];

if ($name == 'Ivanov')

echo " , !";

else

echo ' , '. $name. '!';

?>

 

WHILE

$count=1;

While ($count <=10)

{

Echo $count;

++$count;

}

FOR

For(< >;< >;<>)

For ($count=1; $count<=10; ++$count)

Echo $count;

 

 

1.

.

1. .

2. .

3. .

4. , HTML .

5.

6. .

7. .

8. .

.

4.. , , HTML .

 

. :

.

, 4-5 , .

. , .

 

Include < >

 

include PHP PHP.

PHP , , include. include, PHP include . - , , include . require , require , .

, require , , include PHP .

 

PHP index.php

<?php

$items = array(

array('id' =>100, 'desc' => '- ', 'price' => 24.95),

array('id' =>200, 'desc' => ' ', 'price' => 13.28),

array('id' =>300, 'desc'=> ' PHP', 'price' => 18.80),

array('id' =>400, 'desc' => ' ', 'price' => 100.20));

if (isset($_GET['out']))

{

include 'goodbye.php';

exit();

}

If (!isset($_GET['nom']))

{

include 'ref.html';

exit();

}

if ($_GET['nom'] == NULL)

{

$output=" <br><br>";

include 'forget.php';

exit();

}

if ($_GET['nom']!= NULL)

{

$nom = $_GET['nom'];

$book=$items[$nom]; // $book

include 'output.php';

exit();

}

?>

HTML ref.html

<html>

<head> <!-- -->

<title> . </title>

<meta http-equiv="Content_type" content="text/html; charset=UTF-8">

</head>

<body bgcolor = silver text = green link=red vlink=blue>

<br><br><br>

<div align=center>

<a href="http://Localhost/Lab1_1/?nom=1"> 1 </a><br><br>

<a href="?nom=2"> 2 </a><br><br>

<a href="?nom"> 3 </a><br><br><br><br>

<a href="?out=1"> </a><br><br><br><br>

</div>

</body> </html>.

 



<== | ==>
ғң қ | , .
:


: 2016-12-18; !; : 489 |


:

:

80% - .
==> ...

1515 - | 1361 -


© 2015-2024 lektsii.org - -

: 0.027 .