Placeholder Image

字幕表 動画を再生する

  • So how do you write PHP code in a simple text editor?

  • This is an important concept to understand for new programmers, because many times new programmers are overwhelmed when they see professional type I D E e interfaces.

  • And when they'd go to write code, they simply don't know how to use that complicated software.

  • So it's important.

  • Understand that you can use a simple text editor, too, right?

  • Scripting language code, whether it's PHP, whether it's JavaScript, whether it's Ruby now, the more complicated I D Ys do give you a lot of function alley and make your life a hell of a lot easier when you're writing code, that's hundreds or thousands of lines.

  • But when you're simply trying to start out and learn how to do basic functions, learning how to do basic loops, that type of thing using whatever text editor is already on your computer is a great way to go, so you can use a basic Ask E text editor in order to write your code, and your code will function just the same as if you use something alike in net beans.

  • The only difference is the actual interface that you're going to use.

  • You don't get some of the fancy functionality you get out of something like that beans.

  • But on the other hand, you don't have to learn it.

  • So let's go over to my max so I can kind of show you how a text editor works.

  • And if you're going to be writing PHP code.

  • So this is just my standard Mac computer.

  • This is a 2013 Mac with the operating systems.

  • Actually, last generations I have to upgrade it, but all we're going to be doing in order to write a little bit little snippet of PHP code today is we're going to be using text at it.

  • So I've put text at it down here in my little task bar.

  • So it's easy for me to use in general, But all I would have to do is I go to finder, I goto applications and then I can scroll to find text at it.

  • And you can see that text editors right here.

  • So now I can double click on text, edit, click on new document, and now I can write some PHP code.

  • But before I write the PHP code, I want to set up this text editors environment s so that it doesn't do weird things to me.

  • It's important.

  • Understand?

  • Now when you're going to be using note, pad or text at it that many times would use a text editor.

  • There's things like auto correct or spelling, which can cause you problems if you're gonna be writing code.

  • So in order, just set up this environment, so it's good for creating PHP code.

  • What I'll do is I'll go up to text at it.

  • Then I'll go to Preferences.

  • So basically what you want to do is whatever text editor you're going be using go to preferences and more or less what you're going to do is you're going to d select everything.

  • So from here, my click on plain text so use format menu to choose settings for an open documents were going to go to plain text.

  • We don't want any additional formatting because all we want is that text window size doesn't really matter.

  • Here you can look at the font size, so ah, plain text font size.

  • You can change it here.

  • So for me, since I'm going to be displaying things to you, I want the text to be larger.

  • So I'm gonna take it all the way up to 48.

  • That's just so you can see it.

  • It literally does not matter what size your font is when you're writing a code.

  • All of this is is for how easy it is for you to see.

  • Then we're going to go down here and then you're going to see other options.

  • Check spelling as you type No correct spelling automatically know, show the ruler we don't need that smart quotes.

  • No smart copy.

  • No, no, no, no.

  • So what you're going to do is you're going to d select all of this type of stuff because all you want is that basic text editing you could go to open and save one of things you'll see with text Edit is it has one saving a file ad, not t X T extensions to plain text files.

  • One of things that were going to do is we're going to d select this because when we save a PHP file, we needed to be saved as a dot PHP.

  • So one of the issues that you get into with new coders what they dio is Ah, somebody The text editing software will add dot t x t.

  • So what people will do is they'll do index, not P.

  • It'll save as index dot PHP and then they won't.

  • They won't understand why their code isn't working properly.

  • And the reason is is because a text editor then adds dot TX teaching the end so that it says then basically, what the final name is is index dot PHP dot t x t and as soon as you did at the ad, that dot t x t at the end than the PHP.

  • Interpreter doesn't know what to do with it.

  • So then all we're gonna do from here is we're gonna close.

  • So if this is Windows you'd hit, apply and save.

  • And then from here, we'll do new.

  • And now we get are pretty clean.

  • Nice little environment.

  • So this, you see, there's no there's no rulers.

  • There is no nothing else.

  • And from here, we can write PHP code.

  • So if I want to do, let's say, ah bracket, I want to see, um question mark PHP.

  • So this opens up the PHP tag and I do print do Ah, hello world then a close colon and then I close a PhD.

  • So this is a basic PHP script.

  • I'm not going to really explain it to you very much here.

  • Basically, what this does is this starts the PHP script.

  • We then say print and then we say, Hello world and at the end of every line, every command we do a semi colon and then we close PHP.

  • So this is a full fledged PHP script here, even if it's incredibly simple, then from here, all we do is we go to file and then we're going to go down to safe.

  • And so a click on save.

  • And now it's very important is you see that dot t x t there?

  • We don't want dot t x t.

  • We want to make sure it's always dot PHP.

  • So for this will do test, let's say dot PHP.

  • So this means the file's name is test and it's a PHP file, and then well, then we're going to say where we want to save it, too.

  • So especially, this is one thing you think about it.

  • If you're gonna be uploading this up to a shared hosting server, then you won't put the file in some place.

  • You know where it is.

  • Basically a general You want to know we're gonna be saving it to.

  • So for me, I'll just shove this on the desktop right now.

  • Makes my life easier.

  • Ah, you leave it as Unicode.

  • If no extension, you know, just just the select that dot t x t thing, and then we're going to click safe.

  • So from there, all we d'oh as we can minimize this and we can see right here that Mac os recognizes this is a PHP script.

  • And this is your test file.

  • And so from here, I can now upload this up to a shared hosting or to my server, and then that PHP script will run.

  • So that's all you need to D'oh!

  • Ah, in order to be able to run, um, there be above right PHP scripts using a text editor so you can do this with no pad.

  • You could do this with text edit.

  • You do this with no pad plus plus any of the asking text editors you can write PHP code and it will work fine just the same as if you're using fancy, you know, I de ese or such.

  • So that answer is whether or not you can write a PHP code with a text editor.

  • Um, for the rest of this track in general, I'll be using a basic text editor just to make things simple for you to be able to see how all this operates and so that you really understand that you don't need a complicated idea in order to write PHP.

  • And so that's all there is to it.

  • Um, and that's that's why it matters.

So how do you write PHP code in a simple text editor?

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級

PHP - 書き込み用テキストエディタ... (PHP - Text Editor for Writing...)

  • 0 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語