$ (Function () {, function
"$ (Function () {" similar code appears in the project.
$ (Document). ready (function () {// program segment}) is equivalent to $ (function () {// program segment })
$ (Function (){}
This is the JQuery syntax. $ indicates the JQuery object. It can be used in several ways. For example, if the selector string and page object are passed in directly, this function is executed when the page is loaded.
Function () function usage
A function is actually a unified code block that you can call at any time.
Creating PHP functions:
How to Create a PHP function:
All functions start with the word "function ()"
All functions must start with "function ()"
Name the function-It shoshould be possible to understand what the function does by its name. The name can start with a letter or underscore (not a number)
Name a function: the best way to name a function is to have the same name as the function. The name can contain letters or underscores ).
Add a "{"-The function code starts after the opening curly brace
Add a "{": the code of the function must be written after the "{" symbol.
Insert the function code
Insert a function code
Add a "}"-The function is finished by a closing curly brace
Add "}": After the function is written, the "}" symbol must be added.
Example
Case
A simple function that writes my name when it is called:
The following is a simple PHP function case. When we call it, it can output our name:
<Html> <body>
<? Phpfunction writeMyName () {echo "Kai Jim Refsnes ";}
WriteMyName ();?>
</Body>