search
HomeBackend DevelopmentPHP TutorialA PHP interview question_PHP tutorial

  1. In PHP, the name of the current script (excluding the path and query string) is recorded in the predefined variable (1); and the URL linking to the current page is recorded in the predefined variable (2).
  2. echo $_SERVER['PHP_SELF']; echo $_SERVER["HTTP_REFERER"];

  3. Execution program segmentwill output (3).
  4. 0

  5. In HTTP 1.0, the meaning of status code 401 is (4); if a "File not found" prompt is returned, the header function can be used, and its statement is (5).
  6. (4) Unauthorized (5) header("HTTP/1.0 404 Not Found");

  7. The function of array function arsort is (6); the function of statement error_reporting(2047) is (7).
  8. (6) Reverse sort the array and maintain the index relationship (7)All errors and warnings

  9. The database connection string format in PEAR is (8).
  10. Write a regular expression to filter all JS/VBS scripts on the web page (that is, remove the tags and their contents): (9).
  11. /].*?>.*?>/si

  12. To install PHP as an Apache module, first use statement (10) in the file http.conf to dynamically load the PHP module, and then use statement (11) to make Apache treat all files with the extension php as PHP scripts deal with.
  13. (10) LoadModule php5_module "D:/xampp/apache/bin/php5apache2.dll" (11) AddType application/x-httpd-php-source .phps AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml

  14. The statements include and require can both include another file into the current file. The difference between them is (12); in order to avoid including the same file multiple times, you can replace them with statement (13).
  15. (12) include generates a warning when an exception occurs and require generates a fatal error (13) require_once()/include_once()

  16. The attributes of the class can be serialized and saved to the session, so that the entire class can be restored later. The function used is (14).
  17. serialize() /unserialize()

  18. The parameter of a function cannot be a reference to a variable, unless (15) is set to on in php.ini.
  19. allow_call_time_pass_reference

  20. The meaning of LEFT JOIN in SQL is (16). If tbl_user records the student’s name (name) and student number (ID), tbl_score records the student number (ID), test score (score), and test subject (some students were expelled after taking the exam, and there is no record of them). If you want to print out the name of each student and the corresponding total score of each subject, you can use SQL statement (17).
  21. (16) Natural left outer join (17) select name , count(score) as sum_score from tbl_user left join tbl_score on tbl_user.ID=tbl_score.ID group by tbl_user.ID

  22. In PHP, heredoc is a special string, and its end flag must be (18).
  23. The line containing the terminating identifier cannot contain any other characters except ";"

  24. Write a function that can traverse all files and subfolders in a folder.
  25. /**
    * 遍历目录,结果存入数组。支持php4及以上。php5以后可用scandir()函数代替while循环。
    * @param string $dir
    * @return array
    */
    my_scandir($dir)
    {
        $files = array();
        if ( $handle = opendir($dir) )
        {
            while ( ($file = readdir($handle)) !== false )
            {
                if ( $file != ".." && $file != "." )
                {
                    if ( is_dir($dir . "/" . $file) )
                    {
                        $files[$file] = rec_scandir($dir . "/" . $file);
                    }
                    else
                    {
                        $files[] = $file;
                    }
                }
            }
            closedir($handle);
            return $files;
        }
    } 
  26. Briefly describe the implementation principle of unlimited classification in the forum.
  27. Design a web page so that a full-screen window pops up when it is opened, with a text box and a button in the window. After the user enters information in the text box and clicks the button, the window can be closed, while the entered information is displayed on the main web page.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/752569.htmlTechArticleIn PHP, the name of the current script (excluding path and query string) is recorded in a predefined variable (1 ); and the URL linking to the current page is recorded in the predefined variable (2). ech...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is the best way to send an email using PHP?What is the best way to send an email using PHP?May 08, 2025 am 12:21 AM

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

Best Practices for Dependency Injection in PHPBest Practices for Dependency Injection in PHPMay 08, 2025 am 12:21 AM

The reason for using Dependency Injection (DI) is that it promotes loose coupling, testability, and maintainability of the code. 1) Use constructor to inject dependencies, 2) Avoid using service locators, 3) Use dependency injection containers to manage dependencies, 4) Improve testability through injecting dependencies, 5) Avoid over-injection dependencies, 6) Consider the impact of DI on performance.

PHP performance tuning tips and tricksPHP performance tuning tips and tricksMay 08, 2025 am 12:20 AM

PHPperformancetuningiscrucialbecauseitenhancesspeedandefficiency,whicharevitalforwebapplications.1)CachingwithAPCureducesdatabaseloadandimprovesresponsetimes.2)Optimizingdatabasequeriesbyselectingnecessarycolumnsandusingindexingspeedsupdataretrieval.

PHP Email Security: Best Practices for Sending EmailsPHP Email Security: Best Practices for Sending EmailsMay 08, 2025 am 12:16 AM

ThebestpracticesforsendingemailssecurelyinPHPinclude:1)UsingsecureconfigurationswithSMTPandSTARTTLSencryption,2)Validatingandsanitizinginputstopreventinjectionattacks,3)EncryptingsensitivedatawithinemailsusingOpenSSL,4)Properlyhandlingemailheaderstoa

How do you optimize PHP applications for performance?How do you optimize PHP applications for performance?May 08, 2025 am 12:08 AM

TooptimizePHPapplicationsforperformance,usecaching,databaseoptimization,opcodecaching,andserverconfiguration.1)ImplementcachingwithAPCutoreducedatafetchtimes.2)Optimizedatabasesbyindexing,balancingreadandwriteoperations.3)EnableOPcachetoavoidrecompil

What is dependency injection in PHP?What is dependency injection in PHP?May 07, 2025 pm 03:09 PM

DependencyinjectioninPHPisadesignpatternthatenhancesflexibility,testability,andmaintainabilitybyprovidingexternaldependenciestoclasses.Itallowsforloosecoupling,easiertestingthroughmocking,andmodulardesign,butrequirescarefulstructuringtoavoidover-inje

Best PHP Performance Optimization TechniquesBest PHP Performance Optimization TechniquesMay 07, 2025 pm 03:05 PM

PHP performance optimization can be achieved through the following steps: 1) use require_once or include_once on the top of the script to reduce the number of file loads; 2) use preprocessing statements and batch processing to reduce the number of database queries; 3) configure OPcache for opcode cache; 4) enable and configure PHP-FPM optimization process management; 5) use CDN to distribute static resources; 6) use Xdebug or Blackfire for code performance analysis; 7) select efficient data structures such as arrays; 8) write modular code for optimization execution.

PHP Performance Optimization: Using Opcode CachingPHP Performance Optimization: Using Opcode CachingMay 07, 2025 pm 02:49 PM

OpcodecachingsignificantlyimprovesPHPperformancebycachingcompiledcode,reducingserverloadandresponsetimes.1)ItstorescompiledPHPcodeinmemory,bypassingparsingandcompiling.2)UseOPcachebysettingparametersinphp.ini,likememoryconsumptionandscriptlimits.3)Ad

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools