I don't know much about php. I 'd like to ask a question about wordpress.

Source: Internet
Author: User
If you do not know much about php, ask a question about wordpress & lt ;? Php & nbsp; wp_list_cats ('sort _ column = name & amp; optioncount = 1 & amp; hierarchical = 0'); & nbsp ;? & Gt; this code reports that php is not very familiar. ask a question about wordpress.

This code reports an error

Error reported on the page:
Fatal error: Call to undefined function wp_list_cats () in D: \ phpnow \ htdocs \ mulan \ wp-content \ themes \ muse \ blog. php on line 48
The wp_list_pages () function is not defined.

You want to write templates using html css javascript.
When index. php is linked to blog. php, an error is reported when it is called in blog. php.
However, it would be normal to call index. php directly. index. php and blog. php are in the same directory. I don't understand why. Shared to: what error does this code return? Error: Fa... 'data-pics = ''>
------ Solution --------------------
Index. php
Which function is introduced?
Blog. php does not

You can add some require in index. php to blog. php.
------ Solution --------------------
Require_once is a reference of php.

Like c's include
------ Solution --------------------
Http://www.csharpwin.com/dotnetspace/5716r9253.shtml lz can look at this require_once () function will first check whether the content of the target file has been imported before, if yes, it will not re-import the same content.


------ Solution --------------------
../Write is acceptable, but this relative path is based on the relative path of the script you are running. If you confirm that the file to be referenced is in the directory at the previous level, it is likely that the page actually executed is not the one you expected.

For example:

Directory structure:
Test/1/a. php
Test/2/B. php
Test/2/c. php


A. php
-----------
Require '../2/c. php ';


B. php
-----------
Echo $;


C. php
-----------
$ A = 123;


Run http: // localhost/B. php

You may think it is true, because c. php is indeed a path like ../2/c. php compared with a. php. Unfortunately, if you actually execute B. php, the Directory of the current script is in the same directory as that of c. php. Therefore, c. php should be written:
./C. php or c. php

This is the disadvantage of relative paths. when Files reference each other, the relative paths will make the logic look messy. Therefore, we all like to use relative paths. But it is not good to write the physical path of the disk directly. when your project is migrated, the physical path may change.

The best way to write is based on the absolute path of the web root directory.
It starts with "/". This "/" is the root directory of your website, and then writes down the absolute path.
You can also use realpath and dirname to dynamically return the physical path and then create an absolute path.

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.