Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
ejecutar archivos php en un vue.js

estoy usando el código vs como ide. este es el código de la aplicación.

 <template> <div class="hello"> <!-- Select All records --> <input type='button' @click='allRecords()' value='Select All users'> <br><br> <!-- Select record by ID --> <input type='text' v-model='userid' placeholder="Enter Userid between 1 - 24"> <input type='button' @click='recordByID()' value='Select user by ID'> <br><br> <!-- List records --> <table border='1' width='80%' style='border-collapse: collapse;'> <tr> <th>Username</th> <th>Name</th> <th>Email</th> </tr> <tr v-for='user in users'> <td>{{ user.username }}</td> <td>{{ user.name }}</td> <td>{{ user.email }}</td> </tr> </table> </div> </template> <script> import axios from 'axios'; export default { name: 'HelloWord', data: { users:"", userid: 0 }, methods: { allRecords: function () { axios.get('api/ajaxfile.php') .then(function (response) { app.users = response.data; }) .catch(function (error) { console.log(error); }); }, recordByID: function () { if (this.userid > 0) { axios.get('ajaxfile.php', { params: { userid: this.userid } }) .then(function (response) { app.users = response.data; }) .catch(function (error) { console.log(error); }); } } } } </script>

Al ejecutar el código de la aplicación, las herramientas de desarrollo de Chrome, como Resposnse, me muestran el código fuente del archivo php (que no se ejecuta). El archivo php en otro entorno, usando html, incluidos los archivos axios.js vue.js como script src (CDN), funciona bien. ¿Dónde me equivoco o cómo debo configurar el entorno del código vs?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debido a que localhost:8080 no ejecuta ningún servidor PHP, debe usar un servidor que ejecute PHP, ya sea en su máquina local (por ejemplo, MAMP) o en su servidor público. Si el proyecto reside en la carpeta my_project y el archivo PHP en la subcarpeta static, la tabla proxy debe tener el siguiente aspecto:

 proxyTable: { '/static/dserver.php': { target: 'http://localhost/my_project', changeOrigin: true }

que se resuelve en http://localhost/my_project/static/dserver.php.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!