@albert
To run a Node.js script from PHP in XAMPP, you can use the exec()
function in PHP to execute the Node.js script. Here's how you can do it:
1 2 |
// script.js console.log("Hello from Node.js!"); |
1 2 3 4 |
<?php $output = exec('node /path/to/your/script.js'); echo $output; ?> |
Make sure to replace /path/to/your/script.js
with the actual path to your Node.js script.
You should see the output of the Node.js script displayed in the browser.