Answer the question
In order to leave comments, you need to log in
How to rewrite code in VUE CLI?
Hello dear programmers!
I understand that api is written in PHP and then we access this file through Java Script. Now I want to rewrite my code to VUE CLI and I've run into a problem that I can't access the PHP file.
Please tell me not the code, but the direction. Am I doing something wrong? Just a schematic - how do I implement a simple idea with an API, because for example, INSTAGRAM recommends using PHP for security?
Answer the question
In order to leave comments, you need to log in
The crux of the matter is now clear after reading the comments. You mixed salty with red.
Php has nothing to do with it. You can't just create a php file in your vue folder and expect miracles from it. No, you can create something, but it will not work.
The php file needs a separate php server.
Depending on the development environment. openserver?
Or did you just run npm run serve in your vue folder?
Install openserver or xampp. This is the easiest/fastest. It all depends on the scale and tasks. What should data.php return. database data? Or static data? Then you can simply create a .json file in the folder with vue and take data from it and php is not needed at all. And so look aside - Laravel (bigger) / lumen (easier) - quite affordable php frameworks to get data from data.php, although not. You don't even have to create such a file)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question