Note that there are some explanatory texts on larger screens.

plurals
  1. POphp Fatal error: Cannot redeclare class AppMailCore in /appmail.core.php on line 10
    text
    copied!<p>I'm getting this error when I run the script </p> <pre>php Fatal error: Cannot redeclare class AppMailCore in /appmail.core.php on line 10 </pre> <p>I need to make loop that will also use some variables from a class file . The code from main.php looks like this :</p> <pre> $iesc = 1; while($iesc less than 5) { include('includes/appmail.core.php'); --- </pre> <p> I used "less than " in the code above 'cause I don't know to unescape "&lt;" symbold within the pre markup .</p> <p>I understand that I'm not allowed to re-delcare the class but I don't know how to make the class variables run through the loop . appmail.core.php looks like this </p> <pre> require_once('appmail.config.php'); require_once('helpers'.DIRECTORY_SEPARATOR.'appmail.rest.php'); class AppMailCore { var $AppMailRest; var $api_key; var $url; /** * Initialises AppMailCore. Optionally provide runtime api key and url. */ function AppMailCore($api_key = APPMAIL_API_KEY, $url = APPMAIL_URL) { $this->url = $url; $this->api_key = $api_key; $this->AppMailRest = new AppMailRest($this->url); } /** * Asynchronously sends an email using Google App Engine * * Params are fairly self explanatory. However, note that the "from" address must be a registered email with * your Google App Engine account. */ function send($to, $from, $subject, $plain, $html) { $api_key = $this->api_key; $status = $this->AppMailRest->post('send', compact('api_key','to','from','subject','plain','html')); return $status; } } </pre> <p>the appmail.config.php loooks like this </p> <pre> $app1DB = new mysqli("localhost", "root", "", "ast"); $app1RSP = $app1DB->query("SELECT app_id FROM Application WHERE emails_sent fetch_assoc(); $app_id = $app1Object['app_id']; define('APPMAIL_API_KEY', 'JLQ7P5SnTPq7AJvLnUysJmXSeXTrhgaJ'); define('APPMAIL_URL', "http://$app_id.appspot.com/"); $app1RSP->free(); $app1DB->close(); </pre> <p>Basically I need to get variable APPMAIL_URL/$app_id in the class on each loop run.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload