简体   繁体   English

从命令行运行php脚本,仅显示代码

[英]run php script from command-line only showing code

I using windows 10 creator and want to make a sample of php for test, but when run from commandline, it only showing the code 我使用Windows 10 Creator,并想制作一个php示例进行测试,但是从命令行运行时,它仅显示代码

G:\xampp\htdocs\chat-box>php -v
PHP 5.6.30 (cli) (built: Jan 18 2017 19:48:22)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

G:\xampp\htdocs\chat-box>php bin\chat_server.php
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use ChatWebSocket\Chat;

require dirname(__DIR__) . '/vendor/autoload.php';

$server = IoServer::factory(
    new HttpServer(
        new WsServer(
            new Chat()
        )
    ),
    8080
);
print("Hello WebSocket!")
$server->run();
G:\xampp\htdocs\chat-box>

I have never get this before. 我从来没有得到过 Any problem with my command? 我的命令有问题吗?

您缺少开头<?php标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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