在require("Photo Gallery/includes/PHPMailer/PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Username = "aldemeery@gmail.com";
$mail->Password = "*********";
$mail->From = "aldemeery@gmail.com";
$mail->AddAddress("aldemeery@gmail.com");
$mail->Subject = "Subject";
$mail->Body = "Hi!";
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
网站上关注ES5快速入门后,我得到了以下内容:
movieclip.addEventListener(MouseEvent.MOUSE_DOWN, onMcClick);
function onMcClick(e:MouseEvent):void
{
var target:MovieClip = e.currentTarget as MovieClip;
movieclip = target;
}
var speed:Number = 1.0;
var leftArrow:Boolean=false;
var rightArrow:Boolean=false;
var upArrow:Boolean=false;
var downArrow:Boolean=false;
addEventListener(Event.ENTER_FRAME, moveObject);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHit);
stage.addEventListener(KeyboardEvent.KEY_UP, noKeyHit);
function keyHit(e:KeyboardEvent):void
{
if(e.keyCode == Keyboard.LEFT) leftArrow = true;
if(e.keyCode == Keyboard.RIGHT) rightArrow = true;
if(e.keyCode == Keyboard.UP) upArrow = true;
if(e.keyCode == Keyboard.DOWN) downArrow = true;
}
function noKeyHit2(e:KeyboardEvent):void
{
if(e.keyCode == Keyboard.LEFT) leftArrow = false;
if(e.keyCode == Keyboard.RIGHT) rightArrow = false;
if(e.keyCode == Keyboard.UP) upArrow = false;
if(e.keyCode == Keyboard.DOWN) downArrow = false;
}
function moveObject(e:Event):void
{
if(leftArrow) movieclip.rotation -=0.75;
if(rightArrow) movieclip.rotation +=0.75;
if(upArrow) movieclip.scaleY +=0.01
if(downArrow) movieclip.scaleY -=0.01;
}
我想知道如何为正确的Angular 2
换出.Class方法但不使用mycomponent =
ng.core.Component({
...
})
.Class({
constructor: function() {}
});
(因为它们还不是ES标准的一部分)
答案 0 :(得分:0)
您可以使用annotations
类的ComponentMetadata
属性的getter,如下所述:
import {ComponentMetadata,Inject} from 'angular2/core';
import {FormBuilder} from 'angular2/common';
export class AppComponent {
constructor(fb) {
console.log(fb);
}
static get parameters() {
return [[FormBuilder]];
}
static get annotations() {
return [
new ComponentMetadata({
selector: 'my-app',
template: `
<div>
Test
</div>
`
})
];
}
}
请参阅此plunkr:https://plnkr.co/edit/VqDSDuroK29iAxGzA5Lc?p=preview
您可以注意到像Babel这样的工具支持装饰器。