假设我们通常访问
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?怀疑它会起作用.
谢谢!
我需要一个有循环的shell脚本.在每次循环迭代中,它需要使用一些参数调用PHP文件.有什么办法吗?
我想在某些情况下在后台运行以下代码:
文件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