ipad上编译运行代码

This article was peer reviewed by Claudio Ribeiro. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be!

本文由克劳迪奥·里贝罗 ( Claudio Ribeiro)进行了同行评审。 感谢所有SitePoint的同行评审人员使SitePoint内容达到最佳状态!

I love the iPad. It’s a fantastic form factor for media consumption and gaming; and it also works well as an e-reader. The trouble is I don’t use it nearly as much as I could. Most of the time I’m consuming media (Netflix, Twitch, YouTube), I’m coding in parallel.

我爱iPad。 这是媒体消费和游戏的绝佳形式。 它也可以作为电子阅读器。 麻烦的是我没有尽可能多地使用它。 在大多数情况下,我使用媒体(Netflix,Twitch,YouTube)时,都是并行进行编码的。

I can do that on my MacBook, but I’ve never been able to do that until now. Two things have made it possible:

我可以在MacBook上做到这一点,但直到现在我还是无法做到这一点。 两件事使之成为可能:

  1. iOS recently added support for picture in picture playback. That means I can keep a video app playing, while working on something else.

    iOS最近增加了对画中画回放的支持。 这意味着我可以在处理其他内容的同时继续播放视频应用。

  2. Fantastic apps (like DraftCode and Working Copy) make it possible to code and run PHP apps, and push changes to Github, directly from the iPad.

    出色的应用程序(例如DraftCode和Working Copy )使您可以直接从iPad编码和运行PHP应用程序,以及将更改推送到Github。

Today I’m going to show you how I code on an iPad. I won’t pretend it’s a perfect workflow (what workflow is?), but this is as exciting for me as the first time I used a laptop instead of a desktop.

今天,我将向您展示如何在iPad上进行编码。 我不会假装这是一个完美的工作流程(什么是工作流程?),但这对我来说就像我第一次使用笔记本电脑而不是台式机一样令人兴奋。

I started writing this post a while ago. To tell you the truth, I don’t think the apps I’ve going to talk about were ready then. They’ve both received updates since. It’s as though the developers could hear inside my brain, and wanted to make me happy. I also apologize for the size of this page; there are many animated gifs..

我前一段时间开始写这篇文章。 实话实说,我认为我要谈论的应用当时还没有准备好。 从那以后他们俩都收到了更新。 好像开发人员可以在我的大脑中听到,并想让我开心。 对于此页面的大小,我也表示歉意; 有很多的GIF动画..

硬件 (Hardware)

One of the most important parts of this whole experiment, is finding the right keyboard. When it comes to mobile devices, there’s no shortage of poor-quality hardware.

整个实验中最重要的部分之一就是找到合适的键盘。 在移动设备方面,不乏劣质硬件。

I searched for quite some time before I settled on a keyboard I liked the look of. I can safely say I made the right choice.

在搜寻了喜欢外观的键盘之前,我搜索了很长时间。 我可以肯定地说我做了正确的选择。

This keyboard is about twice the length of the iPad Mini 2, and weighs about the same. The keys feel amazing, with plenty of space between them. And it’s quiet!

该键盘的长度约为iPad Mini 2的两倍,重量也大致相同。 按键感觉很棒,它们之间有足够的空间。 而且很安静!

This keyboard also has a trackpad. iOS doesn’t support mouse or trackpad (as far as I’m aware), so you don’t have to go with a keyboard that has a trackpad. I like this because it can double as an input device for my Raspberry Pi (using a single USB port for keyboard and trackpad).

此键盘还具有触控板。 iOS不支持鼠标或触控板(据我所知),因此您不必使用带有触控板的键盘。 我之所以喜欢它,是因为它可以兼作我的Raspberry Pi的输入设备(使用单个USB端口连接键盘和触控板)。

Unless you’re using a Bluetooth keyboard, you’re going to need a USB port. Fortunately, Apple produce an adapter (originally made for digital camera compatibility), that works wonderfully with every USB keyboard I’ve ever tried.

除非您使用蓝牙键盘,否则将需要USB端口。 幸运的是,Apple生产了一个适配器 (最初是为兼容数码相机而制造的),它可以与我尝试过的每个USB键盘完美配合。

The Windows key doubles as a command key, and Windows + z / Windows + x / Windows + c / Windows + v all work as you’re used to. You can also use Windows + → and Windows + ← to move to the beginning and end of lines.

Windows键兼用作命令键,Windows + z / Windows + x / Windows + c / Windows + v都可以正常工作。 您还可以使用Windows +→和Windows +←移至行的开头和结尾。

The All-in-one Media keyboard is listed as USD 39.95 on the Microsoft website, but you can pick it up for USD 29.99 on Amazon. The Lightning USB adapter is listed as USD 29.99 on the Apple website, and actually costs a couple dollars more from Amazon.

在微软网站上,“多合一媒体”键盘的价格为39.95美元,但您可以在亚马逊上以29.99美元的价格购买。 在苹果网站上,Lightning USB适配器的价格为29.99美元,而从亚马逊购买的价格实际上要高出几美元。

应用 (Apps)

I’ve already mentioned a couple of apps (DraftCode and Working Copy), and the truth is these are the only two you need.

我已经提到了几个应用程序( DraftCode和Working Copy ),事实是这是您仅需要的两个。

What tools do you use to code? You probably use an IDE (or at the very least a text editor, like Atom). You probably use something like Git, to organize and version your source code.

您使用什么工具进行编码? 您可能使用了一个IDE(或者至少是一个文本编辑器,例如Atom)。 您可能会使用Git之类的东西来组织和版本化您的源代码。

DraftCode is a text editor with syntax highlighting. It doesn’t yet support IDE-like features like code completion and static analysis, but it does come with the ability to run the PHP scripts you write in it.

DraftCode是具有语法突出显示功能的文本编辑器。 它尚不支持类似IDE的功能,例如代码完成和静态分析,但它确实具有运行您在其中编写PHP脚本的功能。

What’s more, it includes a file tree through which you can manage files and folders. It’s possible (though somewhat laborious) to structure an entire PHP application through this interface.

此外,它包括一个文件树,您可以通过该树来管理文件和文件夹。 通过此接口可以(尽管有些费力)构造整个PHP应用程序。

We’ll take a look at how to run PHP apps in a bit…

我们将看一下如何运行PHP应用程序…

Working Copy is a Git client. The free version supports Github, Bitbucket, and any other Git URL source. It supports cloning, fetching, and merging. I haven’t tried anything else with it, except for pushing.

工作副本是一个Git客户端。 免费版本支持Github,Bitbucket和任何其他Git URL源。 它支持克隆,获取和合并。 除了推动外,我没有尝试过其他任何方法。

If you want to be able to push the changes you’ve coded on an iPad, you’re going to have to fork out for the enterprise version. The only notable difference (given how little I’ve used it) is that you can only push code to a remote on the enterprise version.

如果您希望能够推送在iPad上编码的更改,则必须购买企业版。 唯一显着的区别(考虑到我很少使用它)是您只能将代码推送到企业版的远程服务器上。

DraftCode costs USD 10.99, and Working Copy (enterprise) costs USD USD 14.99. While I was recording (for the gifs you see before you), I noticed a strange export bug. When the free version was installed, I could export to it. When the enterprise version was installed, I couldn’t. At this stage, I recommend using the free version’s in-app enterprise purchase (for the same price) instead of buying the enterprise version directly.

DraftCode的价格为10.99美元,工作副本(企业)的价格为14.99美元。 当我录制时(对于您之前看到的gif图像),我注意到了一个奇怪的导出错误。 安装免费版本后,我可以将其导出。 安装企业版时,我无法。 在此阶段,我建议您使用免费版本的应用内企业购买(价格相同),而不要直接购买企业版本。

编写您的第一个脚本 (Writing Your First Script(s))

Let’s take a look at the process for writing PHP scripts in DraftCode. After loading (and deleting all manner of example files), the interface is remarkably clean:

让我们看一下用DraftCode编写PHP脚本的过程。 加载(以及删除示例文件的所有方式)之后,界面非常干净:

At the bottom of the file tree (the left panel), there are a few buttons. The Cog (settings button) shows a bit of information about the app, and provides buttons to install WordPress and phpLiteAdmin (a SQLite phpMyAdmin clone).

在文件树的底部(左侧面板),有一些按钮。 Cog(设置按钮)显示了有关该应用程序的一些信息,并提供了用于安装WordPress和phpLiteAdmin (SQLite phpMyAdmin克隆)的按钮。

Then, there are buttons for creating files, folders, importing media files, and batch moving files (in that order). The media importer draws from the iPad’s media library, so it supports any audio/video/image file you could otherwise play on the iPad.

然后,有用于创建文件,文件夹,导入媒体文件和批处理移动文件的按钮(按此顺序)。 媒体导入器来自iPad的媒体库,因此它支持您可以在iPad上播放的任何音频/视频/图像文件。

Let’s create a script. It’s useful to know which version of PHP and which modules are available through the app. You can create a file named just about anything (but a common name for this kind of script would be index.php or phpinfo.php):

让我们创建一个脚本。 知道该应用程序可以使用哪个版本PHP和哪些模块,这很有用。 您可以创建几乎任何名称的文件(但这种脚本的通用名称是index.phpphpinfo.php ):

尝试SQLite (Trying SQLite)

You may have noticed a few mentions of MySQL (in phpinfo). That doesn’t mean that you can start using a MySQL database on your iPad, just that you could connect to a publicly accessible MySQL server.

您可能已经注意到MySQL的一些提及(在phpinfo )。 这并不意味着您可以在iPad上开始使用MySQL数据库,而可以连接到可公开访问MySQL服务器。

DraftCode does have the SQLite extension though. Let’s use that, and PDO, to test whether we can use SQLite databases:

DraftCode确实具有SQLite扩展名。 让我们使用它和PDO来测试是否可以使用SQLite数据库:

date_default_timezone_set("UTC");
$handle = new PDO("sqlite::memory:");
$handle->setAttribute(
PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION
);
$handle->exec("
CREATE TABLE IF NOT EXISTS messages (
id INTEGER PRIMARY KEY,
message TEXT
)
");
$query = "
INSERT INTO messages (message) VALUES (:message)
";
$statement = $handle->prepare($query);
$statement->bindParam(":message", $message);
$message = "hello world";
$statement->execute();

Most of this is just standard PDO example code, though I’ll forgive you for being unfamiliar with it. We live in the age of database abstractions layers and object-relational mappers.

虽然我会原谅您不熟悉它,但大多数只是标准的PDO示例代码。 我们生活在数据库抽象层和对象关系映射器的时代。

We open a handle to an in-memory SQLite database, and set the error mode to throw exceptions. Then we create a messages table, with a single message text field.

我们打开内存中SQLite数据库的句柄,并将错误模式设置为引发异常。 然后,我们创建一个带有单个message文本字段的messages表。

We follow this up by preparing a SQL query, and binding a :message parameter to this prepared statement. Finally, we execute the prepared statement, and fully expect the messages table to contain a single row.

接下来,我们准备一个SQL查询,并将:message参数绑定到该准备好的语句。 最后,我们执行prepared语句,并完全希望messages表包含一行。

Let’s try fetching this row, using the following code:

让我们尝试使用以下代码获取此行:

$messages = $handle->query("
SELECT * FROM messages
");
foreach($messages as $message) {
print "message: " . $message["message"] . "<br>" . PHP_EOL;
}

SQLite isn’t a replacement for other, more robust databases, but we can use it to develop apps that will only ever serve a single user.

SQLite不能替代其他功能更强大的数据库,但我们可以使用它来开发仅可为单个用户提供服务的应用程序。

使用工作副本提取代码 (Pulling Code With Working Copy)

More often than not, I find myself working on an existing codebase. It would be awful if I had to recreate the whole working directory by hand. Luckily we can just use Working Copy to pull the source code from a Git server.

我发现自己经常在现有的代码库上工作。 如果不得不手动重新创建整个工作目录,那将是可怕的。 幸运的是,我们可以使用工作副本从Git服务器中提取源代码。

If we plan to push code back up to Github (assuming that’s the remote we’re using), it’s a good idea to set up an identity and connect with Github:

如果我们计划将代码备份回Github(假设这是我们正在使用的远程服务器),那么最好设置一个身份并与Github连接:

It’s not strictly necessary, but at least it’s out the way (for when we want to push code we’ve added/changed). The next step is to clone a repository. We can send code to DraftCode using the share dialog. Working Copy archives the repository, and stores some PHP code to extract it to the iOS clipboard. To extract the repository (inside DraftCode), we need to create a new file, paste the clipboard code, and run it.

这不是严格必要的,但至少是可以避免的(因为当我们想要推送代码时,我们已经添加/更改了)。 下一步是克隆存储库。 我们可以使用共享对话框将代码发送到DraftCode。 工作副本将存储库存档,并存储一些PHP代码以将其提取到iOS剪贴板。 要提取存储库(在DraftCode内部),我们需要创建一个新文件,粘贴剪贴板代码,然后运行它。

安装Laravel (Installing Laravel)

The latest version of Laravel (5.3 as I write this) supports PHP 5.6 and SQLite databases. That’s great news for us, but there’s still a bit of work we need to do to get it working.

Laravel的最新版本(我撰写本文时为5.3 )支持PHP 5.6和SQLite数据库。 这对我们来说是个好消息,但是要使它正常工作,我们仍然需要做一些工作。

提交依赖 (Committing Dependencies)

As we’ve seen, any code we want to run has to be run through DraftCode’s server. That means we can’t easily use Composer to install dependencies. It’s theoretically possible to make a script for this, but that’s a topic for another time.

如我们所见,我们要运行的任何代码都必须通过DraftCode的服务器运行。 这意味着我们不能轻易使用Composer安装依赖项。 从理论上讲,可以为此编写脚本,但这是另一个话题。

The quickest way to give Laravel all the dependencies it needs, is to store them in Git. That way, we can pull an entire Git repository down, and deploy it to DraftCode’s working directory.

向Laravel提供所需的所有依赖关系的最快方法是将它们存储在Git中。 这样,我们可以下拉整个Git存储库,并将其部署到DraftCode的工作目录。

vendor is ignored in Laravel apps by default. You’ll have to remove it from .gitignore to be able to commit it to the repository.

默认情况下,Laravel应用中将忽略vendor 您必须将其从.gitignore删除才能将其提交到存储库。

定制环境 (Customizing The Environment)

.env is another ignored file. When you pull the Git repository down, you’re probably not going to have a version of the Laravel app will use (unless you intentionally committed .env in the first place).

.env是另一个被忽略的文件。 当您拉下Git存储库时,可能不会使用Laravel应用程序的版本(除非您首先故意提交了.env )。

It’s not currently possible to create (or edit) .env or .env.example without first giving them a .txt extension. You’ll need .env, with a valid APP_KEY value before Laravel can create sessions.

如果没有.env.example他们提供.txt扩展名,则当前无法创建(或编辑) .env.env.example 。 你需要.env ,具有有效APP_KEY值之前Laravel可以创建会话。

艾康 (Iconv)

The version of PHP DraftCode provides doesn’t have the iconv_* function set. We can use the patchwork/utf8 library to shim these functions.

PHP DraftCode提供的版本未设置iconv_*函数。 我们可以使用patchwork/utf8库来填充这些功能。

Laravel 4.* used to have patchwork/utf8 as a dependency. This was removed in 5.0

Laravel 4.*过去曾经把patchwork/utf8作为依赖项。 5.0中已将其删除...

To add it, we can use:

要添加它,我们可以使用:

composer require patchwork/utf8

As with most PHP shims, the right time to add them is directly following the Composer autoloader. The very first time this happens in Laravel, is in public/index.php.

与大多数PHP垫片一样,添加它们的正确时间是紧随Composer自动加载器之后。 这是Laravel第一次出现在public/index.php

In fact, the default state of public/index.php is:

实际上, public/index.php的默认状态为:

<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package  Laravel
* @author   Taylor Otwell <taylor@laravel.com>
*/
/*
| ...
*/
require __DIR__.'/../bootstrap/autoload.php';
/*
| ...
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
| ...
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);

This is from https://github.com/laravel/laravel/blob/5dc817bf55598fda017e3b7f39957447bda94846/public/index.php

这是从https://github.com/laravel/laravel/blob/5dc817bf55598fda017e3b7f39957447bda94846/public/index.php

So, to add the shim for iconv_* functions, we need to add the following line:

因此,要为iconv_*函数添加垫片,我们需要添加以下行:

require __DIR__.'/../bootstrap/autoload.php';
\Patchwork\Utf8\Bootup::initAll();

随机字节 (Random Bytes)

Laravel also depends on paragonie/random_compat:~1.4|~2.0. This library provides various shims for the newer cryptography improvements of the language. Chief among them is the ability to generate random data in a cryptographically secure way.

Laravel还取决于paragonie paragonie/random_compat:~1.4|~2.0 。 该库为语言的最新密码学改进提供了各种填充。 其中最主要的是以加密安全方式生成随机数据的能力。

What makes this generation cryptographically secure is the source of entropy. The shim uses various sources, which can be seen here.

使这一代在密码学上安全的是熵的来源。 垫片使用各种来源,可以在此处看到。

Unfortunately, the only source supported by the DraftCode version of PHP is the openssl_random_pseudo_bytes function. And though the comment says that the library will fall back to openssl_random_pseudo_bytes as a last resort, this functionality was removed in version 1.3, to be replaced by a function that throws an exception.

不幸的是,PHP的DraftCode版本支持的唯一来源是openssl_random_pseudo_bytes函数。 尽管评论说该库将作为最后手段退回到openssl_random_pseudo_bytes ,但是此功能在1.3版中已删除,由引发异常的函数代替。

Laravel requires ~1.4, which means we can’t require ^1.2 in our project without getting a composer error. The only alternative is to get the implementation from the 1.2 version of paragonie/random_compat, and including it before Composer’s autoloader.

Laravel需要~1.4 ,这意味着我们可以不要求^1.2没有得到一个作曲家的错误在我们的项目。 唯一的选择是从paragonie/random_compat1.2版本中获取实现,并将其包括在Composer的自动加载器之前。

If you’re wondering why we would need to include it before, it’s because paragonie/random_compat registers that exception-throwing random_bytes function globally (and as soon as it is loaded by Composer). This creates a situation where one shim library prevents all other shim libraries (of the same type) from working. A curious position to take…

如果您想知道为什么我们需要在此之前添加它,这是因为paragonie/random_compat注册了paragonie/random_compat异常的random_bytes在全局范围内起作用(并在Composer加载后立即起作用)。 这会造成一种情况,即一个填充程序库会阻止所有其他(相同类型的)填充程序库正常工作。 一个奇怪的立场

Please don’t let my criticism of this single aspect of paragonie/random_compat make you think I don’t like the library. It’s fantastic, and you should probably be using it in favor of your own shim implementation.

请不要让我对paragonie/random_compat的这一方面的批评使您认为我不喜欢该库。 这太棒了,您可能应该使用它来支持自己的填充程序实现。

The openssl_random_pseudo_bytes implementation source looks like this:

openssl_random_pseudo_bytes实现源看起来像这样:

function random_bytes($bytes)
{
try {
$bytes = RandomCompat_intval($bytes);
} catch (TypeError $ex) {
throw new TypeError(
'random_bytes(): $bytes must be an integer'
);
}
if ($bytes < 1) {
throw new Error(
'Length must be greater than 0'
);
}
$secure = true;
$buf = openssl_random_pseudo_bytes($bytes, $secure);
if (
$buf !== false
&&
$secure
&&
RandomCompat_strlen($buf) === $bytes
) {
return $buf;
}
throw new Exception(
'Could not gather sufficient random data'
);
}

This is from here

这是这里

You can save that anywhere you like, but I’ve saved it to path/to/project/compat-random.php. We need to add it above the Composer autoloader:

您可以将其保存到任何喜欢的位置,但是我已经将其保存到path/to/project/compat-random.php 。 我们需要将其添加到Composer自动加载器上方:

if (!function_exists('random_bytes')) {
require_once __DIR__.'/../compat-random.php';
}
require __DIR__.'/../bootstrap/autoload.php';
\Patchwork\Utf8\Bootup::initAll();

This way, the openssl_random_pseudo_bytes implementation will be used (if random_bytes doesn’t already exist), and paragonie/random_compat won’t register an exception-throwing random_bytes.

这样,将使用openssl_random_pseudo_bytes实现(如果不存在random_bytes ),并且paragonie/random_compat将不会注册引发异常的random_bytes

This is obviously not as secure as the alternative shim functions inside paragonie/random_compat. You shouldn’t run this hack in production.

这显然不如paragonie/random_compat的替代shim函数安全。 您不应该在生产中运行此hack。

自定义路线 (Custom Routes)

Before we talk about custom routes, let’s run the Laravel app as it is:

在讨论自定义路线之前,让我们按原样运行Laravel应用:

So far, so good! But, if we’re running public/index.php then how do we ever change routes to somewhere else in our app? To enable this, we need to modify public/index.php again:

到目前为止,一切都很好! 但是,如果我们正在运行public/index.php那么如何将路由更改为应用程序中的其他位置? 为此,我们需要再次修改public/index.php

$_SERVER["REQUEST_URI"] = $_GET["url"];
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);

Before each request, we override the REQUEST_URI with whatever we provide to the url query string parameter. This works because Request::capture() proxies to the underlying HTTPRequest::createFromGlobals Symfony implementation. The same implementation builds various URI states based on REQUEST_URI.

在每个请求之前,我们使用提供给url查询字符串参数的任何内容覆盖REQUEST_URI 。 之所以HTTPRequest::createFromGlobals ,是因为Request::capture()代理了基础的HTTPRequest::createFromGlobals Symfony实现 。 相同的实现基于REQUEST_URI构建各种URI状态。

Now, we can create new routes, like:

现在,我们可以创建新的路线,例如:

Route::get("/then", function() {
return "hello world";
});

…And navigate to them with the URL http://127.0.0.1/tutorial-coding-on-the-ipad/public/index.php?url=then.

…并使用URL http://127.0.0.1/tutorial-coding-on-the-ipad/public/index.php?url=then导航到它们。

使用工作副本推送代码 (Pushing Code With Working Copy)

Once you’ve made changes to your repository, you’ll probably want to commit and push them. Navigate up to the root repository folder, and tap the folder name. You’ll see an option to zip the folder. This will take some time, depending on the size of the codebase. When complete, you can select and share the archive with Working Copy.

对存储库进行更改后,您可能需要提交并推送它们。 导航到根存储库文件夹,然后点击文件夹名称。 您会看到一个压缩文件夹的选项。 这将需要一些时间,具体取决于代码库的大小。 完成后,您可以选择文件并与工作副本共享。

Working Copy can then identify which files were changed, and allows you to commit them back to the repository.

然后,工作副本可以识别出哪些文件已更改,并允许您将它们提交回存储库。

结论 (Conclusion)

In this tutorial, we looked at the hardware, software, and configuration requirements for developing PHP apps on the iPad. We looked at some of the supported features (and limitations) of DraftCode’s PHP.

在本教程中,我们研究了在iPad上开发PHP应用程序的硬件,软件和配置要求。 我们研究了DraftCodePHP的一些受支持的功能(和限制)。

Before we part ways, I think it’s a good idea to talk about why we’d want to code on the iPad. This has been a fun experiment for me, but I don’t imagine an iPad could become my coding machine of choice. The apps have improved (dramatically) over the past few weeks, but they’re still slow to use (owing to the limitations of sandboxing and not being able to run CLI scripts).

在分手之前,我认为谈论一下为什么要在iPad上进行编码是个好主意。 对我而言,这是一个有趣的实验,但是我不认为iPad可以成为我选择的编码机。 在过去的几周中,这些应用程序已经得到了很大的改进,但是使用起来仍然很慢(由于沙箱的限制以及无法运行CLI脚本)。

There is a certain appeal to using the iPad, if you find yourself flying often. If you can get a neat case for them, the iPad, keyboard and adapter are much neater than a MacBook and charger. The iPad can charge on a plane, and the touch screen makes the occasional break-for-a-game viable.

如果您发现自己经常飞行,那么使用iPad有一定的吸引力。 如果您可以为它们装扮得井井有条,则iPad,键盘和适配器比MacBook和充电器要整洁得多。 iPad可以在飞机上充电,触摸屏使偶尔的游戏破灭变得可行。

That said, any Surface + keyboard combo is probably more comfortable to use. With a Surface, you don’t need to install these specialist apps – you can install a normal IDE and a usable PHP 7.0 environment.

也就是说,任何Surface +键盘组合都可能更舒适地使用。 使用Surface,您不需要安装这些专业应用程序–您可以安装普通的IDE和可用PHP 7.0环境。

So, am I saying you should go for a Surface? No.

所以,我是说您应该选择Surface吗? 没有。

Let’s look at the costs involved, for the workflow I’ve described in this tutorial:

让我们看看本教程中描述的工作流程所涉及的成本:

  1. You need an iPad, a keyboard, and a USB connector. If you already own an iPad, that’s USD 29.99 for the connector and the cost of the keyboard. Or you could get a Bluetooth keyboard.您需要iPad,键盘和USB连接器。 如果您已经拥有iPad,则连接器和键盘的价格为29.99美元。 或者,您可以获得蓝牙键盘。
  2. You need DraftCode, which is USD 10.99. You can get away with the free version of Working Copy (if all you’re not interested in pushing back to a remote, or you’re happy emailing your project around).您需要DraftCode,即USD 10.99。 您可以免费获得工作副本的免费版本(如果您不希望将其全部推送回远程,或者您很乐意通过电子邮件向您发送项目)。

Let’s say you had none of these things. You’d have to pay:

假设您没有这些东西。 您必须支付:

  1. USD 269 → iPad Mini 2 (Apple)269美元→iPad Mini 2(苹果)
  2. USD 29.99 → Camera kit connector (Apple)USD 29.99→相机套件连接器(苹果)
  3. USD 29.99 → All-in-one Media keyboard (Amazon)USD 29.99→多合一媒体键盘(亚马逊)
  4. USD 10.99 → DraftCode10.99美元→DraftCode
  5. USD 14.99 → Working CopyUSD 14.99→工作副本

That comes to USD 381.96 (or USD 85.96 if you already own the iPad). The cheapest Surface 3 you can buy (from Microsoft) is USD 499, and you don’t even get the keyboard with it. Aside from coding, I’d far rather have the iPad.

费用为381.96美元(如果您已经拥有iPad,则为85.96美元)。 您可以从Microsoft购买到的最便宜的Surface 3是499美元,甚至连键盘都没有。 除了编码之外,我宁愿拥有iPad。

It’s not going to replace your current workflow, but it’ll do in a pinch, and it’s fun to try. Have you tried something similar yet? How do you code when traveling? Let us know what worked for you in the comments below.

它不会取代您当前的工作流程,但会在一定程度上完成,尝试很有趣。 您是否尝试过类似的方法? 旅行时如何编码? 在下面的评论中让我们知道对您有用的。

翻译自: https://www.sitepoint.com/is-it-possible-to-write-and-run-php-code-on-an-ipad/

ipad上编译运行代码

ipad上编译运行代码_是否可以在iPad上编写和运行PHP代码?相关推荐

  1. wordpress代码_如何在WordPress网站上轻松显示代码

    wordpress代码 Do you want to display code in your WordPress blog posts? If you tried to add code like ...

  2. java调用子系统代码_深入理解JAVA虚拟机-Idea远程执行本地Java代码 - Java 技术驿站-Java 技术驿站...

    今天在看深入理解JAVA虚拟机的9.3节,作者实现了一个远程执行功能.这个功能可以在远程服务器中临时执行一段程序代码,而去不依赖jdk版本,不改变原有服务端程序的部署,不依赖任何第三方库,不入侵原有的 ...

  3. python 打包 无需安装运行环境_无需Python环境,小白也可以运行的抢票程序

    阅读文本大概需要 5 分钟. 又到周末了,pk 哥抽空对抢票程序作了优化,并把优化后的程序做打包处理,打包后没有 Python 环境的电脑也可以正常运行程序了.前两篇关于抢票的文章没看可点下方链接查看 ...

  4. python项目软件代码_七套Python库快速提升您项目的代码可维护性,软件工程,代码库...

    保护项目未来可维护性的一种理想方式,在于利用外部库检查您的代码运行状况.以下是目前开发人员最喜爱的的代码梳理库,它们能够以强制方式执行一致性样式,并确保项目在成熟之后仍具备可接受的测试覆盖率. 当软件 ...

  5. python爬小说代码_中文编程,用python编写小说网站爬虫

    原标题:中文编程,用python编写小说网站爬虫 作者:乘风龙王 原文:https://zhuanlan.zhihu.com/p/51309019 为保持源码格式, 转载时使用了截图. 原文中的源码块 ...

  6. jmeter之java代码性能测试_松勤软件性能测试-自定义编写的Java测试代码在Jmeter中如何使用...

    原标题:松勤软件性能测试-自定义编写的Java测试代码在Jmeter中如何使用 我们在做性能测试时,有时需要自己编写测试脚本,很多测试工具都支持自定义编写测试脚本,比如LoadRunner就有很多自定 ...

  7. tfs管理java代码_使用Intellij Idea连接Team Foundation Server (TFS)实现代码版本管理

    Intellij Idea是一个Java项目开发工具,支持Windows,MAC OS和Linux的跨平台开发环境,具备良好和智能的用户界面,在欧洲市场拥有很多粉丝.https://www.jetbr ...

  8. 有趣的html代码_千万别惹程序员,否则会在代码注释里,告诉这家公司有多坑...

    Python现在非常火,语法简单而且功能强大,很多同学都想学Python!所以小的给各位看官们准备了高价值Python学习视频教程及相关电子版书籍,都放在了文章结尾,欢迎前来领取! 每个程序员敲代码都 ...

  9. 运算阶乘的代码_【必修1】2.4可以复用的代码

    学习目标 ★了解函数的作用. ★学会函数的定义和调用方法,并能熟练使用函数解决问题. ★学会发布共享代码的常见方法,并能熟练使用模块解决问题. 本课要点 任务一  用自定义函数实现火柴摆数字问题 活动 ...

  10. java 批量上传pdf文件_使用fileinput插件批量上传文件

    使用fileinput插件批量上传文件 前言 最近在做项目的时候涉及文件批量上传,使用bootstrap结合fileinput插件批量上传文件!以下是我在使用fileinput上传文件的过程.项目是基 ...

最新文章

  1. Bzoj3261 最大异或和
  2. undefined reference to `sqrt‘ 问题
  3. 你会使用回调函数吗?
  4. mysql在计算机管理中的路径怎么修改_称重软件中的数据修改怎么知晓?
  5. 第1课贝贝的交通指挥系统(《聪明人的游戏:信息学探秘.提高篇-2017-06-C++版》)
  6. 网络攻防技术——shellcode编写
  7. python语句只能以程序方式打开_python如何处理程序无法打开
  8. EM78P153单片机构成433MHz发射电路
  9. java中如何配置前端项目,将后端或前端项目部署到云服务器上
  10. 针对PVS方式的VDI部署趋势杀毒优化方法
  11. 成都榆熙:怎么解除拼多多商品的推广限制
  12. 银河系创投徐芳:专注B2B这片热土,燃起产业新势能
  13. Gboard导入简体中文词库,详细操作教程。
  14. TFN F4 高性能OTDR光时域反射仪 都具有哪些优势?
  15. WifiManager自动连接wifi接入点
  16. Arouter源码解析(二)——ASM和JavaPoet
  17. ubuntu更新软件包
  18. “药药切克闹”系列-基于STM32触摸屏的超级无敌智能电子密码锁(仿手机键盘26键设计,密码支持英文大写+英文小写+数字)
  19. 2013再见,2014,在路上
  20. 多谐振荡器双闪灯电路分析

热门文章

  1. 编译原理教程_10 代码优化和目标代码生成
  2. 读懂用户运营体系:用户分层和分群
  3. 977计算机考研,中国海洋大学 977计算机技术与软件工程专业课经验分享
  4. 前向断言/前向预查/正向断言/正向预查(lookahead assertions)
  5. Visual Studio Installer 一直提取文件0B不动怎么办:修改DNS教程
  6. ad转换中断方式C语言程序,STC12C2052AD AD转换C程序 +PWM输出功能实现
  7. Matlab底层算法实现图像的平移
  8. CDlinux万能无线破解系统iSO中文版 U盘启动版
  9. Merged region B8 must contain 2 or more cells
  10. 【原型】Axure基本入门