Use of Undefined Constant Stdin - Assumed 'Stdin' in C:\Wamp\Www\Study\Sayhello.PHP on Line 5

Use of undefined constant STDIN - assumed 'STDIN'

<?php

echo "Hello there. So I hear you're learning to be a PHP programmer!\n";

echo "Why don't you type in your name for me:\n";

$stdin = fopen('php://stdin', 'r');

$name=trim(fgets($stdin));

echo "\nThanks, " . $name . ", it's really nice to meet you.\n\n";

fclose($file);

?>

Use of undefined constant STDIN - assumed 'STDIN' in C:\wamp\www\study\sayHello.php on line 5

Just define STDIN constant at top of your file,

define('STDIN',fopen("php://stdin","r"));

Google OAuth 2.0 PHP API Authentication fails: Use of undefined constant STDIN

Thanks, @sean-bright for pointing out the existing question. While it didn't not answer my question, it got me closer to the solution.

It turns out Google's sample is designed to be run from a CLI and my browser-based implementation was not providing a means of prompting the user for input that is called for by that STDIN line.

Since the auth code is provided as a parameter in the $authUrl variable that gets printed to the screen the first time the script is run, I was able to resolve my issue by replacing

$authCode = trim(fgets(STDIN));

with:

$authCode = $_GET['code'];

Artisan::call('migrate') not working after upgrading Laravel to 4.2

Yes, there is a problem actually with the last version,all previous sources are not working, should use :

Artisan::call('migrate', array('--force' => true));

Tested and working fine.



Related Topics



Leave a reply



Submit