ほぼ独学でPHPerになったITかあさんが言いたい、PHPのオススメ勉強法 エイプリルフールですが、これと言って嘘の予定はありませんITかあさんです。いつかはこんなことを書いてみたかった
段田です。 最近、PHPからiphone端末にPUSH通知を送る機能の開発に携わりました。PHPでプログラムを実装する場合、フルスクラッチとライブラリを使用するケースがあるのですが、各ケースでのポイントを忘れないよう書きたいと思います。 なおPUSH通知の概要、証明証の作成については省略します。概要などは下記の記事がわかりやすく、参考になりました。 Apple Push Notification サービス(APNs) の実装方法 iPhoneプッシュ通知まとめ フルスクラッチのケース フルスクラッチでやる場合、こちらのはてなの記事が参考になりました。 https://irss.hatenablog.com/entry/20111026/1319632548 しかし、試しに作成すると送信はできるのですが、下記の様な制約があることを知ります。 1つのメッセージで256バイトを超えてはいけない
こんにちはこんにちは!! Webプログラミングしてますか! よく「PHPはセキュリティがダメ」とか言われてるよね。 でもそれって、べつにPHPが悪いんじゃなくて、 たぶん、セキュリティとかが、まだよくわからない人が多いだけなんじゃないかな。 がんばって勉強しようと思っても、なんだか難しい理屈が並んでいたりするしね…。 なので今日は、セキュリティ対策について、 「これだけやっとけば、わりと安全になるよ」ってことを、初心者むけに、大雑把に書いてみます! 理屈がわからなくても、最初はコピペでも、 なにもやらないより、やったほうがきっとマシになる! 1. XSS対策 動的なものを表示するとき、全部エスケープすればokです! (NG) あなたの名前は <?= $name ?> ですね! ↓ (OK) あなたの名前は <?= htmlspecialchars($name, ENT_QUOTES) ?>
4. TCP/IP送ったら送った順に届く$fp = stream_socket_client('tcp://www.nicovideo.jp:80');fwrite($fp, "GET / HTTP/1.0");fwrite($fp, "Host: www.nicovideo.jp");echo stream_get_contents($fp);fclose($fp); 6. TCP/IPちゃんと届けられる$fp = stream_socket_client('tcp://www.nicovideo.jp:80', $errno, $errstr);if ($fp=== false) { throw new Exception($errstr);}if (fwrite($fp, "GET / HTTP/1.0") === false) { throw new Exception($php_
まったくプログラムの下地がない人がPHPの入門書を読むと挫折する。筆者はプログラミングの下地がまったくないノンプログラマーである。数年前から、PHPの勉強をや独学ではじめた。PHPの本は何冊買ったかわからない(洋書も含めて40冊以上は買ってきた)。買っては挫折の繰り返しだった。現在、てもとに残ったのは数冊である。 以下は、今後PHPを完全な独学で勉強したい人のためのメモである。 良本でプログラミングの下地をつくる 最初のコツはいきなりPHPの本に手を出さないことである。とくに初心者の方がネックになるのは条件分岐、ループ、配列あたりである。このあたりはPHP以外の本で定評のある本を読んで基礎を固めておきたい。 『新版Perl言語プログラミングレッスン入門編』か『初めてのプログラミング 第2版』のどちらかを読んでおこう。前者はPerl、後者はRubyの本であるがPHPでも基礎は同じで役に立つ。
去年の話ですが、海外でこんな記事が上がっていました。 20 Tips you need to learn to become a better PHP Programmer 記事の内容は、かなりレベルが低いです。 しかし、初心者のうちに知っておけば、より早く成長出来るでしょう。 初心者PHPerのために、この記事の翻訳を載せます。 20 Tips you need to learn to become a better PHP Programmer PHPは、同じオブジェクトの扱い方でも複数の書き方を持っている、とても気まぐれなプログラミング言語だ。 詳しくは、私の書いた”The Art of Programming“を読むと良い。 これから書くTipsは、過去のプロジェクトから私が学んだコードの可読性、メンテナンス性を上げ、あなたを素晴らしい、より進んだPHPプログラマーにするもの
PHPを始めたばかりのころ自分なりにやってた工夫と、それこうした方がいいんじゃないのという提案 2010年12月07日 09:00PHP PHP Advent Calendar jp 2010 に参加しています。 PHP に関する記事を日替わりで書こうというイベントですね。 昨日の slywalker さんに続いて6日目。 さて PHP というかウェブに関することは何もかも独学で 始めたばかりの頃は特に 一般的なやり方というものがさっぱりわかっていなかったので わかることの範囲内で自分なりの工夫をしてました。 そういう経験はとても大切だと思うんだけど、 かなり無駄な手間がかかっていたり やらない方がいいことをやっていたりもしたので 導いてくれる人がいなかったその頃の自分に対して こうやってはどうか、という提案を書いてみようと思います。 「なに、そんな愚かしいことしてたの」 と言いたくなるよ
デフォルトではXML形式の空要素を出力しますが、PHP 5.3.0から第2引数にfalseを指定すると<br>として出力できるようにもなりました。 この関数はもはやPHPerなら常識でしょうか? ■mb_strimwidth 文字を丸める関数です。 <?php $string = "アシアルは今、より多くのお客様にサービスを提供していこうと考えています。業務内容には多くの範囲が含まれますが、自身のアイデアを活かしたい、今までにないWebサービス を作りたい、PHP言語に興味がある、といった方は、アシアルで一緒に頑張ってみませんか?"; echo mb_strimwidth($string, 0, 60, '...', 'UTF-8');
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く