简体   繁体   中英

Separately execute a section of php code on a web page

This is a best practice type question. I'm dealing with two different frameworks. When I execute a piece of code from one framework on the page of another framework, I'm getting a code conflict. What I'm wondering is how to execute a piece of code on a separate web page and bring in the results AFTER the php on that page has executed and produced its HTML.

One Possible Solution

Use Curl - I could house the additional code on a curl page and bring it in that way, but that seems to have a lot of overhead associated with it.

Is there a lower overhead way of doing this than using curl?

More info

Specifically in this case I'm trying to use a magento php script in my page, and the autoloader is trying to load in other scripts in the directory that should not be auto loaded.

Resolve the 'conflict' by wrapping the library code in an class where you define the interface. Then call that class directly.

Adding a server side request to another resource will extend the time each request takes (remember the second request has to fire up a database connection, load the framework, carry out a db query etc).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM