Results 1 to 25 of 26
Thread: PHP - URL
Hybrid View
-
1st March 2011 21:51 #1Banned
Join Date: Jan:2009
Location: -
Posts: 126
PHP - URL
PHP URL index.php index.php?page=aboutus index.php?aboutus
-
1st March 2011 21:59 #2
. " ".
, URL Rewriting ( mod_rewrite ), , , .
?page=aboutus
$_GET['page'];
-
1st March 2011 22:17 #3Banned
Join Date: Jan:2009
Location: -
Posts: 126
-
1st March 2011 22:38 #4
, .. - .
- (index.php ):
<?php
$page = '';
if (isset($_GET['page'])) $page = $_GET['page'];
if (!$page) {
?>
, . , .. .
<?php
}
if ($page == 'aboutus') {
?>
-, index.php?page=aboutus
<?php
}
?>
..
page=XXXX, ( page).
- :
<?php
$page = '';
if (isset($_GET['page'])) $page = $_GET['page'];
if (!$page) include 'index.html';
if ($page == 'aboutus') include 'aboutus.html';
if ($page == 'products') include 'products.html';
?>
..
, else-, , 2-3-4 -, switch,
. else - .
-
2nd March 2011 14:35 #5
- . - .
echo include- , , -.PHP Code:<?php
$page = $_GET['page'];
switch ($page){
default:
echo "kakvo da se pokazva, kogato promenlivata page e prazna..";
break;
case "aboutus":
echo "about us";
break;
case "another_page":
echo "nqkva druga stranica";
break;
}
-
2nd March 2011 17:29 #6Registered User
Join Date: Jul:2006
Location:
Posts: 1,071
?

Tedych, .PHP Code:$page = isset($_GET['page']) ? $_GET['page'] : '';
-
2nd March 2011 20:14 #7
mKrotiFy, ,
(). - break-.
else- , , .
mialy, . , , 2 ,
.
.. . .
-
8th March 2011 11:18 #8Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
if , switch ... case .
-
8th March 2011 11:40 #9
switch .
, if - .
if (....) {
-->operator;
}
switch (...) {
-->case 123:
-->-->operator;
-->-->operator;
-->break;
--case ....
}
. , 1-2-3 - .
-
8th March 2011 22:16 #10Registered User
Join Date: Jul:2006
Location:
Posts: 1,071
:
Coding Styles Linux . , switch-a case- . , case 'opa': { ...; break }. C ( ISO 99), .PHP Code:switch($neshto) {
case 'blabla':
code...;
code...;
break;
case 'blabla2':
code...;
default: // ,
}
, , , ... PHP , IF, ==, === ()!
, =
-
8th March 2011 22:48 #11
, 2 3 "" ( ) PHP, .
, , .
, , $str == '0', empty($str), .
..
foreach , , .
-
10th March 2011 15:11 #12Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
php
foreach, - n . , . OR, AND, XOR.Code:$a = false OR true;var_dump($a); -> false
-
10th March 2011 15:23 #13
foreach- , ?
Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
.
-
10th March 2011 15:43 #14Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
foreach .
,Code:foreach($arr as $val) print $val; -> $val .
. , . , .Code:foreach($arr as $value)
-
10th March 2011 23:28 #15
, , , $val foreach, ..
, ( ).
foreach ($arr as $index=>$value)
'0', '1', .. , $index .
( ), , .
, ,
.
.
-
11th March 2011 10:03 #16
, , $val, .
JS , - - .
WTF is this:
Code:function test (param) { // ( ) : :D if (param == null) param = 0; } test();Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
.
-
14th March 2011 17:16 #17Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
-
14th March 2011 20:46 #18Mire-x
Join Date: Apr:2005
Location: Sofia
Posts: 763
(10b) || !(10b)
-
15th March 2011 11:03 #19Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
, .
Code:function test (param) { if (param == null) param = 0; } test(); console.log(param); -> ReferenceError: param is not definedCode:var param; function test (param) { if (param == null) param = 0; } test(); console.log(param); -> undefined
:
Code:function test (param) { try { eval('('+param+')'); } catch(e) { eval('(var '+param+' = 0)'); } } test('alabala'); console.log(alabala); -> 0
-
16th March 2011 09:59 #20
To , param {}
:
, , ( C, PHP...), .. , , - "".Code:function test (param) { console.log(param); if (param == null) param = 0; console.log(param); } test();
A , :
Code:var SomeVar = { testvar: 5, testvar2: 8, someMethod: function (param) { return (param + SomeVar.testvar2); } //, .... } alert(SomeVar.someMethod(5));Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
.
-
16th March 2011 07:24 #21Mire-x
Join Date: Apr:2005
Location: Sofia
Posts: 763
, :
Code:function test(param) { document.write('typeof(param): ' + typeof(param) + '<br />'); document.write('typeof(null): ' + typeof(null) + '<br />'); document.write('(param == null): ' + (param == null).toString() + '<br />'); document.write('(param === null): ' + (param === null).toString() + '<hr />'); if (param == null) param = 0; document.write('param: ' + param + '<hr />'); } test();
Originally Posted by Firefox 3.6.15, Opera 11.01, IE 7.0
(10b) || !(10b)
-
16th March 2011 08:17 #22Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
-
16th March 2011 14:00 #23
, :
, , .Code:function test (param) { document.write(param+'<br>'); } test(47944811969396736); //47944811969396740 test('47944811969396736'); //47944811969396736
Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
.
-
16th March 2011 14:22 #24Registered User
Join Date: Jul:2005
Location: Sofiq
Posts: 2,798
. 34654576346756745764567457645764 3.4654576346756744e+31 -
-
16th March 2011 14:42 #25
JS Integer 2^53, - integer, float. - .
EDIT:>>
- :
http://blog.vjeux.com/2010/javascrip...er-limits.html
EDIT.2:>>
test(), , string, .''? * *
- !
...




Reply With Quote


Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in