// Laravel 7 example
namespace App\Http\Controllers;
class Contact extends Controller
{
// ...
/**
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<div id="app"> | |
<div class="nes-container with-title is-centered"> | |
<p class="title">Vue Form Test</p> | |
<form @submit.prevent="submit"> | |
<div class="nes-field"> | |
<label for="name_field">Character Name</label> | |
<input placeholder="Enter name here" type="text" | |
name="name" | |
id="name_field" class="nes-input" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types=1); | |
require_once __DIR__.'/vendor/autoload.php'; | |
use Symfony\Component\Process\Process; | |
$process = new Process(['php', 'index.php']); | |
echo "Starting process\n"; | |
$process->start(); |
Array are not object in PHP but PHP does give us some ways to make object that act like arrays. First, there is the ArrayObject class which is pretty close to what you have with a normal array (you can iterate it, use [] etc.) If you use it as a parent for your class you can add methods to it.
class ArrObj extends ArrayObject{
// add methods here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var handleRequest = function(data) { | |
postMessage(data) | |
} | |
addEventListener('message', function(e) { | |
var xhr = new XMLHttpRequest | |
xhr.open('GET', e.data) | |
xhr.onreadystatechange = function(e) { | |
if (xhr.readyState === 4 && xhr.status === 200) { | |
handleRequest(xhr.responseText) |