Php practice day 10 _ PHP Tutorial

Source: Internet
Author: User
The tenth day of php practice. Today, the front-end of the waterfall message board is finished. let's take a look. the serialize () serialized unserialize () deserialized functions are compiled into c. Today, the front-end of the waterfall message board is finished. let's take a look.


What I learned today

Serialize () serialization

Unserialize () deserialization

The two functions compile the config_set () and config_get () functions.


[Php]
/**
* Used to write out array configurations
*/
Function config_set ($ fileName, $ arr_var ){
File_put_contents ($ fileName, serialize ($ arr_var ));
}
/**
* Used to read the configuration. the returned value is the set array.
*/
Function config_get ($ fileName ){
If (file_exists ($ fileName )){
Return unserialize (file_get_contents ($ fileName ));
}
}

/**
* Used to write out array configurations
*/
Function config_set ($ fileName, $ arr_var ){
File_put_contents ($ fileName, serialize ($ arr_var ));
}
/**
* Used to read the configuration. the returned value is the set array.
*/
Function config_get ($ fileName ){
If (file_exists ($ fileName )){
Return unserialize (file_get_contents ($ fileName ));
}
} Call method


[Php]
$ Config = array (
'Title' => 'Waterfall message board ',
"B" => 'AAA'
);

Config_set ("data. php", $ config );


$ Config = config_get ('data. php ');

Var_dump ($ config );

$ Config = array (
'Title' => 'Waterfall message board ',
"B" => 'AAA'
);

Config_set ("data. php", $ config );

$ Config = config_get ('data. php ');

Var_dump ($ config );
2. how to use the '[]' in the jquery selector, remove the style from the removedClass, and add the style to the addClass to easily highlight the style.

Var focus_li = $ ("# menu li [class! = Nav-header] ");
Focus_li.click (function (){

Focus_li.removeClass ("active"); // remove all highlighted styles
$ (This). addClass ("active"); // add a highlighted style to the clicked

3. for session, unset ($ _ sesstion) cannot be cleared. session_unset () is used ()


4. rewrite the chrome browser in the message form at the front end. the effect of IE is less special and not very nice.


[Html]


5. the drop-down button in the background is very beautiful.


[Html]




Welcome Back <{$ userName}>


  • View website


  • Log out






Welcome Back <{$ userName}>


  • View website


  • Log out



Summary. what I learned today: serialize () serialized unserialize () deserialized by the two functions, compiled c...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.