ÏêϸÏÈÈÝthinkphpµÄ×°Öð취
thinkphp ÊÇÒ»¿îÇáÁ¿¼¶µÄ php ¿ª·¢¿ò¼Ü£¬¾ßÓиßЧÂÊ¡¢ÎÞаÐÔºÍÇå¾²ÐÔµÈÓŵ㡣Ëü¼òÆÓÒ×Óã¬ÊʺϿª·¢ÖÖÖÖ¹æÄ£µÄ web Ó¦ÓóÌÐò¡£±¾ÎĽ«ÏêϸÏÈÈÝ thinkphp µÄ×°Öð취¡£
µÚÒ»²½£ºÏÂÔز¢½âѹ thinkphp ¿ò¼Ü
Äã¿ÉÒÔÔÚ thinkphp ¹ÙÍøÉÏÏÂÔØ×îа汾µÄ thinkphp ¿ò¼Ü£¬²¢½âѹµ½ÄãµÄЧÀÍÆ÷ÖС£Ò²¿ÉÒÔÔÚÏÂÁîÐÐÖÐʹÓà git clone ÏÂÁî´Ó GitHub ÉÏÏÂÔØ£º
$ git clone https://github.com/top-think/think.git
µÇ¼ºó¸´ÖÆ
»òÕß´Ó composer ×°Öãº
$ composer create-project topthink/think=6.0.* your-project-name
µÇ¼ºó¸´ÖÆ
µÚ¶þ²½£ºÉèÖÃÇéÐαäÁ¿
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
ÔÚ Windows ²Ù×÷ϵͳÏ£¬ÄãÐèÒª½« php.exe ËùÔÚĿ¼Ìí¼Óµ½ÏµÍ³ÇéÐαäÁ¿ PATH ÖС£ÔÚ Linux ºÍ macOS ϵͳÏ£¬ÄãÐèÒª±à¼ÇéÐαäÁ¿Îļþ£¨Èç /etc/profile¡¢~/.bash_profile£©£º
export PATH=$PATH:/path/to/php/bin
µÇ¼ºó¸´ÖÆ
µÚÈý²½£º½¨ÉèÐéÄâÖ÷»ú
thinkphp ʹÓÃÐéÄâÖ÷»úÀ´´¦Öóͷ£ÇëÇó£¬ÄãÐèÒª½¨ÉèÒ»¸öÐéÄâÖ÷»ú²¢ÉèÖÃËüµÄ»á¼û·¾¶ÒÔ¼°Ó¦ÓóÌÐòµÄ¸ùĿ¼¡£ÔÚ Apache ЧÀÍÆ÷ÖУ¬Äã¿ÉÒԱ༠/etc/httpd/conf/httpd.conf ÎļþÌí¼ÓÒÔÏÂÄÚÈÝ£º
<virtualhost> ServerName your-app.local DocumentRoot /path/to/your/app/public <directory> AllowOverride All Require all granted </directory></virtualhost>
µÇ¼ºó¸´ÖÆ
ÔÚ Nginx ЧÀÍÆ÷ÖУ¬Äã¿ÉÒԱ༠/etc/nginx/sites-available/default ÎļþÌí¼ÓÒÔÏÂÄÚÈÝ£º
upstream backend { server unix:///var/run/php-fpm.sock; } server { listen 80; server_name your-app.local; root /path/to/your/app/public; location / { index index.php; try_files $uri /index.php$is_args$args; } location ~ \.php$ { fastcgi_pass backend; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
µÇ¼ºó¸´ÖÆ
µÚËIJ½£º²âÊÔÓ¦ÓóÌÐò
»á¼ûÄãµÄÐéÄâÖ÷»ú£¬Äã»á¿´µ½ thinkphp µÄ½Ó´ýÒ³Ãæ¡£Äã¿ÉÒÔÔÚ¿ØÖÆÆ÷ºÍÊÓͼÖÐÌí¼ÓÄã×Ô¼ºµÄ´úÂ룬ÖØмÓÔØÓ¦ÓóÌÐò¼´¿É²âÊÔÄãµÄÓ¦ÓóÌÐò¡£
×ܽá
×°ÖúÍÉèÖà thinkphp ÓÐÐí¶àÖÖÒªÁ죬±¾ÎÄÖ»ÌṩÁËÒ»ÖÖ³£Óõķ½·¨¡£×°ÖÃÍê³Éºó£¬ÄãÐèÒªÊìϤ thinkphp µÄ»ù´¡ÖªÊ¶£¬°üÀ¨¿ØÖÆÆ÷¡¢ÊÓͼ¡¢Ä£×ӵȿ´·¨£¬²Å»ª¸üºÃµØʹÓÃËüÀ´¿ª·¢ Web Ó¦ÓóÌÐò¡£
ÒÔÉϾÍÊÇÏêϸÏÈÈÝthinkphpµÄ×°Öð취µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡