Với đa số các bạn lập trình web newbie, có lẽ đôi khi các bạn cần thực hiện một chức năng đồng loạt trên nhiều dòng với việc xác định dòng bangwd checkbox hay radiobox. Dưới đây tôi chia sẽ cách thực hiện, hi vọng có thể giúp được các bạn.
Working history!
Nhật ký công tác.
Jun 17, 2014
Feb 26, 2014
Hàm Kiểm tra ngày tháng có đúng không trong php.
function
isValidDateTimeString(
$str_dt
,
$str_dateformat
,
$str_timezone
) {
$date
= DateTime::createFromFormat(
$str_dateformat
,
$str_dt
,
new
DateTimeZone(
$str_timezone
));
return
$date
&& DateTime::getLastErrors()[
"warning_count"
] == 0 && DateTime::getLastErrors()[
"error_count"
] == 0;
}
Sep 24, 2013
PHP isset() vs empty() vs is_null()
PHP has different functions which can be used to test the value of a variable. Three useful functions for this are isset(), empty() and is_null(). All these function return a boolean value. If these functions are not used in correct way they can cause unexpected results.
isset() and empty() are often viewed as functions that are opposite, however this is not always true. In this post I will explain the differences between these functions.
Jun 26, 2013
Tạo user trong CentOS
#useradd -m -d /var/www/html/user1 user1
#passwd user1
#chown -R user1:apache /var/www/html/user1
# chmod 755 -R /var/www/html/user1
#passwd user1
#chown -R user1:apache /var/www/html/user1
# chmod 755 -R /var/www/html/user1
Jun 14, 2013
Kiểu DateTime trong PHP
Một số thủ thuật để xử lý DateTime trong PHP: lấy ngày tháng hiện tại, so sánh ngày, tính thời gian chênh lệch giữa 2 ngày.
May 29, 2013
Expanding CakePHP multistep forms with dynamic fields and serialized data
As a sequel to the post about multistep forms with CakePHP, I’d like to add a little bit of complexity to that sample. This time we’ll add some dynamically generated fields and, in general, serialized data.
Write less code: merge Save and Edit in CakePHP
In most cases writing less code gives the developer a series of
advantages: it’s easier to maintain and extend, easier to read and
easier to debug! In this post I’m going to suggest a little CakePHP tip
that in the long run will save you a lot of coding.
Some develepers already implement this method, but I think it deserves much wider usage: I’m talking about merging model save and edit in a single controller method.
Some develepers already implement this method, but I think it deserves much wider usage: I’m talking about merging model save and edit in a single controller method.
Multistep forms in CakePHP 2.2.2
One of the features I really love about PHP frameworks
is form management. Coding forms in plain PHP can easily become a pain
if not well planned out. Multistep forms take this complexity even
further, especially when you care about user experience.
In this tutorial you’ll be amazed by how much little code can manage a whole full featured multistep form when taking advantage of CakePHP powerful classes. We’ll build the form in only 60 lines of controller code.
In this tutorial you’ll be amazed by how much little code can manage a whole full featured multistep form when taking advantage of CakePHP powerful classes. We’ll build the form in only 60 lines of controller code.
May 25, 2013
CsvExport Behavior for CakePHP 2
This
behavior is the exact opposite of the CsvImport behavior included in
the Utils plugin from CakeDC. This Behavior will end on github but for
now, here is the source code and instructions on how to use the
Behavior.
Subscribe to:
Posts (Atom)