相关疑难解决方法(0)

PHP在linux命令提示符下传递$ _GET

假设我们通常访问

http://localhost/index.php?a=1&b=2&c=3
Run Code Online (Sandbox Code Playgroud)

我们如何在linux命令提示符下执行相同的操作?

php -e index.php
Run Code Online (Sandbox Code Playgroud)

但是传递$ _GET变量怎么样?也许像php -e index.php --a 1 --b 2 --c 3?怀疑它会起作用.

谢谢!

php linux

122
推荐指数
7
解决办法
10万
查看次数

如何从shell脚本文件中调用PHP文件

我需要一个有循环的shell脚本.在每次循环迭代中,它需要使用一些参数调用PHP文件.有什么办法吗?

php bash shellexecute

3
推荐指数
1
解决办法
2万
查看次数

在后台运行PHP脚本(不使用Cron)

我想在某些情况下在后台运行以下代码:

文件A:

// ------------------- Some Code Before Following -----------------------

// send notification to given device token
$notification = new Notification();                    
$notification->sendNotification($token,$count);

// ------------------- Some Code After Above ------------------------
Run Code Online (Sandbox Code Playgroud)

这将称为以下类:

// Here I am sending notification to given device token (APNS Push Notification) 
<?php

class Notification
{
    public function sendNotification($token,$count)
    {
        if(strlen($token)%16 == 0)
        {
            // set Device token
            $deviceToken = $token;
            $passphrase = 'xxxxx';
            $badge = $count;

            // Displays alert message here:
            $message = 'Hello! There.';

            $ctx = stream_context_create();
            stream_context_set_option($ctx, …
Run Code Online (Sandbox Code Playgroud)

php notifications background-process apple-push-notifications

2
推荐指数
1
解决办法
4167
查看次数