Obtain the string containing the file execution result-php Tutorial

Source: Internet
Author: User
Obtain the string containing the file execution result to describe the problem. a simple model is provided below:
For example, a file named a. php contains the following content:

Welcome: Cancel



There is another file B. php
 


In B. php can read File. php content is not post-execution content. if you want to explain the code in php and get the following result for $ s, is there any good way?

Welcome: James canceled


Reply to discussion (solution)

Directly require/include

Directly require/include
I know this, but I want to get this string ~~~

$ S = file_get_contents ('http: // localhost/a. php ');

Replace "include" with the specific content you want.

B. modify php as follows:

ob_start();include 'a.php';$s = ob_get_clean);

Parentheses are missing.

ob_start();include 'a.php';$s = ob_get_clean();

The problem has been solved in another way. thank you !!!

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.