PHP


To use escaped characters like \t use them in double quotes like "\t" not single quotes like '\t'
----------------------
Version
    php --version
    /usr/sbin/apache2 -v
----------------------
Install phpmyadmin + lamp
$ sudo apt-get install mysql-server
$ sudo apt-get install phpmyadmin
$ sudo vim /etc/apache2/apache2.conf
    Include /etc/phpmyadmin/apache.conf      # this include will add the directory dependency and paths of phpmyadmin to apache :)
$ sudo /etc/init.d/apache2 restart
----------------------
Maximum upload size 2M usually for development and back-up recivery purposes set it to 64
/etc/php5/apache2/php.ini
----------------------
php5-dev
Will provide access to
$ phpize : prepare a php extension for compilation
PHP Api Version        
Zend Module Api No    
Zend Extension Api No  
$ php-config
----------------------

Session

Before you can store user information in your PHP session, you must first start up the session. 
Note: The session_start() function must appear BEFORE the <html> tag:

The correct way to store and retrieve session variables is to use the PHP $_SESSION variable:

<?php
session_start();
// store session data
$_SESSION['views']=1;
?>

<html>
<body>
<?php
//retrieve session data
echo "Pageviews=". $_SESSION['views'];
?>
</body>
</html>

<?php
session_destroy();
?>


If you wish to delete some session data, you can use the unset() or the session_destroy() function. session_destroy() will reset your session and you will lose all your stored session data.

Variables

isset()
unset()

scope

once you declare a variable in a php page, it will be accessible in the page and in the included or required pages or modules mentioned in the page.




sudo apt-get install php5-curl














ċ
PHPstrip_attributes.rar
(62k)
Morteza Sh-,
Jul 15, 2011, 2:53 PM
Comments