Joke Collection Website - Blessing messages - How to edit index.php How to write index.php

How to edit index.php How to write index.php

How to modify the code index php in my website? Are you referring to how to modify the index.php portal file or the website homepage? It is recommended that you find someone who knows some MVC knowledge, and then you can modify the content of the homepage. If you really want to modify the homepage yourself, you must first have background management or server management permissions, and then go in and find the index() method in the index module corresponding to the relevant index.php import file. See if the content you want to modify is here? Or find the index. *The tpl template file corresponding to the (html or tpl) file (usually under tpl or template).

It is recommended that you find someone who understands PHP to solve the problem.

How does PHP realize web page jump after successful login to the web page, from login to index?

1. First, open the php editor and create a new php file, for example: index.php;

2. In index.php, enter the code: header('Location: index .php');

3. When the browser runs the login.php page, it will jump to the index.php page;

How to deploy the PHP project?

1. Alibaba ECS server configuration 1. Because there are already several sites online, it is necessary to configure ngnix multi-site 2. Alibaba Cloud ecs directory structure, ngxin is in the /etc/nginx/ directory, configure The main place is

nginx.config file.

Or create a new configuration file in

conf.d and then include it in the

nginx.config file

3.nginx.config to create a new site information server{listen80 ;server_namewww.yourdomain.com; relative path to the root site; index

index.php

index.htmlindex.htm; #charsetkoi8-r; #access_log/var/log /nginx/

host.access.logmain;#Loadconfigurationfilesforthedefaultserver

block.include/etc/nginx/

default.d/*.conf;location/ {#try_files$uri$uri//index.php;root/opt/www/pcweb/ytyy_pc;index

index.php

index.htmlindex.htm; if(! -e$request_filename){rewrite^(.*)$/index.php?s=$1last;break;}}url rewrite (optional)#redirectservererrorpagestothestaticpage/40x.html#error_page404/404.html;40 error page Configuration location=/

40x.html{}#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html; 50 error page configuration location=/

50x.html{}location~ .php${root site relative path; fastcgi_pass127.0.0.1:9000; fastcgi_indexindex.php; fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; includefastcgi_params;}location~/

.ht{denyall;}} configuration file The basic content is as above; after the configuration is completed, test whether the configuration file is correct so that the configuration can be used. Then restart the nginx server so that the nginx configuration is completed and can be used. Put the site files in the corresponding directory. I just gitclone it. 2.

The transfer of the .thinkphp project file was originally thought to be finished after uploading. The first problem I encountered when uploading was an error when accessing the page. The page was hijacked by Telecom's 114 page. . . The omnipotent Baidu solution to the error message that Ma Dan can’t see

1. Internet advanced options-gt; Privacy-gt; Add new blocked sites to the site Solution 2: Control Panel-gt; Network and internet-gt; Local connection-gt; properties-gt; ipv4 using the following IP is finally done and you can see the error page. . . . . . Damn it. Open the universal Baidu method again and get the final conclusion that it is caused by file directory permissions. thinkphp's runtime directory does not have write permission. . Thinkphp files uploaded to Alibaba seem to have this problem.

Solving the problem is very simple. Go to the project file directory and directly chmod-R777 the highest file permissions//linux to modify the file permissions

How to solve index.php?

Because you have not set a default homepage file in the background, the first one is index.php. Just go to the control panel and set the order.

How to create functions correctly in PHP?

tep1=gt;

php extension modules are placed in the ext/ directory, such as snmp module and mysql module. If we want to create our own module, we must create a directory for our module in the ext directory. For example, if we want to make a module that analyzes config files and name it pconfig module (abbreviation of parseconfig), we need to create the directory pconfig under ext. Copy the 7 files I wrote to this directory. In addition, some modifications need to be made to configure and internal_functions.c in the main directory.

Step2=gt;

Makefile.amMakefile.in

is a template file. When the user executes configure, these two files will be called to generate the Makefile. When modifying, replace the lowercase pconfig with your own module name, and don't forget to replace the uppercase PCONFIG as well (don't tell me you don't know the vi replacement statement). config.m4 is also the detection script that will be called when executing configure. We will discuss more in-depth modifications of these scripts later. Now you just need to make pconfig your module. The same goes for config.h.stub and setup.stub. In fact, setup.stub is of no use.

Step3=gt;

In the php3-pconfig.h header file

externphp3_module_entrypconfig_module_entry;

#definepconfig_module_ptrpconfig_module_entry

#definephpext_pconfig_ptrpconfig_module_ptr

These lines define the entrance of the module. After registering the entrance to php, php will find the function you wrote through the module entrance

The following function definitions are Macros are defined. After expansion, they are actually php3_minit_pconfig and php3_rinit_pconfig? which are called when your module is initialized or completed respectively. If your module is very simple, you do not need these definitions

externPHP_MINIT_FUNCTION(pconfig );

externPHP_RINIT_FUNCTION(pconfig);

externPHP_MSHUTDOWN_FUNCTION(pconfig);

PHP_MINFO_FUNCTION(pconfig);

This is your function Statement, the function name written in the php script statement in the future is the name defined in PHP_FUNCTION.

PHP_FUNCTION(pconfig_test);

If there are multiple, you can continue to add them

PHP_FUNCTION(pconfig_parsefile);

PHP_FUNCTION (pconfig_release);?.

Step4=gt;

Next we look at the most important C code

function_entrypconfig_functions={

PHP_FE(pconfig_test, NULL)

{NULL, NULL, NULL}

};

What is defined is the entrance of your function (we mentioned earlier (through the module entrance), write the functions you defined in the header file according to the format. Note that this is defined using macros, regardless of whether the syntax is correct. We will discuss the usage of these macros in detail later.

php3_module_entrypconfig_module_entry={

"pconfig", pconfig_functions, PHP_MINIT(pconfig), PHP_MSHUTDOWN(pconfig), PHP_RINIT(pconfig), NULL, PHP_MINFO(pconfig), STANDARD_MODULE_PROPERTIES

};

Register the entry information of the module, such as module name, function interface, functions to be called by the initialized module, etc. If your module does not perform complex operations, you can ignore them. Written as

php3_module_entrypconfig_module_entry={

"pconfig", pconfig_functions, NULL, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES

};

Step5=gt;

Write your own function

In the header file and function_entry, we have defined our own function pconfig_test, now we will implement the function of pconfig_test. For example, perform the sum of two numbers.

staticvoid_php3_pconfig_test(INTERNAL_FUNCTION_PARAMETERS)

{......

}

PHP_FUNCTION(pconfig_test)

{

_php3_pconfig_test(INTERNAL_FUNCTION_PARAM_PASSTHRU);

}

When the system calls pconfig_test, your _php3_pconfig_test function will be called. Of course, you can also use _php3_pconfig_test The content is written directly in PHP_FUNCTION(pconfig_test). This only makes the program structure clearer.

Note: Do not name _php3_pconfig_test as php3_pconfig_test. After the PHP_FUNCTION (pconfig_test) macro is expanded, it is actually php3_pconfig_test!

Step6=gt;

Okay, now we start to modify configure. echo$ac_n"checkingforMySQLsupport""...$ac_c"1gt; in front of 6 (of course, if you are familiar with configure, you can add it in any appropriate place) add the following sentences

iftest" ${with_pconfig set}"=set; then

withval="$with_pconfig"

#Addyourlibinhere

EXTRA_LIBS="$EXTRA_LIBS"

#Addyourincludepathinhere

INCLUDES="$INCLUDES"

EXT_SUBDIRS="$EXT_SUBDIRSpconfig"

EXT_LIBS="$EXT_LIBSpconfig/libphpext_pconfig.a"

EXTINFO_DEPS="$EXTINFO_DEPS../ext/pconfig/extinfo.c.stub"

EXT_STATIC="$EXT_STATICpconfig"

fi

Modify internal_functions.c and add #include "ext/pconfig/php3_pconfig.h" to the header file definition

Add phpext_pconfig_ptr to the zend_module_entry array,

Step7=gt;

Configure again and bring the required parameters. Don’t forget to add --with-pconfig to the parameters

Step8=gt;

index.php3 echopconfig_test(123 , 678)."

"?gt;

Execute phpindex.php3

MACNginx PHP How to remove index.php using ThinkPHP?

You can set the default document to another file name in nginx.